Return a number for calculation purposes

G

Guest

I have a database for pulling up jpg files. The user has 8 drop-down combo
boxes to choose from.
When done, this:
([Combo1] & "_" & [Combo3] & "_" & [Combo7] & "_" & [Combo10] & "_" &
[Combo12] & "_" & [Combo14] & "_" & [Combo16] & "." & [Combo19])

Becomes this, which is the jpg file name, in Textbox221:
900_DDA_AF_COLOR_150_MIXED_LARGE.JPG

I also have the following, which looks in my "List" table and finds the
record for that jpg file that matches the “file nameâ€, in TextBox142:

\JP-server13\database\JPG File\" & [Combo1] & "_" & [Combo3] & "_" &
[Combo7] & "_" & [Combo10] & "_" & [Combo12] & "_" & [Combo14] & "_" &
[Combo16] & "." & [Combo19])

I use it to populate a “file size†combo box and a “score†combo box…both
are numbers. I’ve got the properties set like this:
Name: Combo277
Control Source: Text 221
Format: Standard
Row Source Type: Table/Query
Row Source: SELECT LIST.[File Name], LIST.[File Size] FROM LIST;
After Update: [Event Procedure]
Which is this:

Private Sub Combo277_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[File Name] = '" & Me![Combo277] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I need to use the Score and File Size to do some calculations. When I try
to reference the Combo Boxes (227 and 305) and get the number they are
displaying, I get 9500_DNA_ADF_COLOR_75_MIXED_LARGE instead…which is the
Control Source instead of the end result of the Combo Box.

What am I doing wrong, please.
Thank you for your help.
Greta
 
G

Guest

Gee... said:
I have a database for pulling up jpg files. The user has 8 drop-down combo
boxes to choose from.
When done, this:
([Combo1] & "_" & [Combo3] & "_" & [Combo7] & "_" & [Combo10] & "_" &
[Combo12] & "_" & [Combo14] & "_" & [Combo16] & "." & [Combo19])

Becomes this, which is the jpg file name, in Textbox221:
900_DDA_AF_COLOR_150_MIXED_LARGE.JPG

I also have the following, which looks in my "List" table and finds the
record for that jpg file that matches the “file nameâ€, in TextBox142:

\JP-server13\database\JPG File\" & [Combo1] & "_" & [Combo3] & "_" &
[Combo7] & "_" & [Combo10] & "_" & [Combo12] & "_" & [Combo14] & "_" &
[Combo16] & "." & [Combo19])

I use it to populate a “file size†combo box and a “score†combo box…both
are numbers. I’ve got the properties set like this:
Name: Combo277
Control Source: Text 221
Format: Standard
Row Source Type: Table/Query
Row Source: SELECT LIST.[File Name], LIST.[File Size] FROM LIST;
After Update: [Event Procedure]
Which is this:

Private Sub Combo277_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[File Name] = '" & Me![Combo277] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I need to use the Score and File Size to do some calculations. When I try
to reference the Combo Boxes (227 and 305) and get the number they are
displaying, I get 9500_DNA_ADF_COLOR_75_MIXED_LARGE instead…which is the
Control Source instead of the end result of the Combo Box.

What am I doing wrong, please.
Thank you for your help.
Greta

Hi Greta,

For Combo227 (you didn't post anything about Combo305), you have two columns
for the row source: [File Name] and [File Size]. To get the file size you
need to use the Column() property and referance the second column:

forms!YourForm!Combo227.Column(1)

The row source column count is zero based, so the second column ([File
Size]) is column 1.


In the after update event of Combo227, you created an object. You should add
two lines before the end sub:

rs.Close
Set rs = Nothing


Everything else is confusing me.... (since I can't see your database<g>). It
looks like there are 8 unbound combo boxes (in the form header?) and a
calculated(?) text box (Textbox221) that holds the jpg file name. And another
(calculated?) text box holds the fully qualified file name of the jpg.

Combo227 is bound to the (calculated?) control Textbox221, that changes the
form current record in the after update event, which seems to defeat the
purpose of having the combo box bound....(and might lead to data
confusion/corruption....)

Again, I can't see your database, so I am easily confused.... :-O

HTH
 
G

Guest

It was the Column(1) solution that worked...thanks!

SteveS said:
Gee... said:
I have a database for pulling up jpg files. The user has 8 drop-down combo
boxes to choose from.
When done, this:
([Combo1] & "_" & [Combo3] & "_" & [Combo7] & "_" & [Combo10] & "_" &
[Combo12] & "_" & [Combo14] & "_" & [Combo16] & "." & [Combo19])

Becomes this, which is the jpg file name, in Textbox221:
900_DDA_AF_COLOR_150_MIXED_LARGE.JPG

I also have the following, which looks in my "List" table and finds the
record for that jpg file that matches the “file nameâ€, in TextBox142:

\JP-server13\database\JPG File\" & [Combo1] & "_" & [Combo3] & "_" &
[Combo7] & "_" & [Combo10] & "_" & [Combo12] & "_" & [Combo14] & "_" &
[Combo16] & "." & [Combo19])

I use it to populate a “file size†combo box and a “score†combo box…both
are numbers. I’ve got the properties set like this:
Name: Combo277
Control Source: Text 221
Format: Standard
Row Source Type: Table/Query
Row Source: SELECT LIST.[File Name], LIST.[File Size] FROM LIST;
After Update: [Event Procedure]
Which is this:

Private Sub Combo277_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[File Name] = '" & Me![Combo277] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I need to use the Score and File Size to do some calculations. When I try
to reference the Combo Boxes (227 and 305) and get the number they are
displaying, I get 9500_DNA_ADF_COLOR_75_MIXED_LARGE instead…which is the
Control Source instead of the end result of the Combo Box.

What am I doing wrong, please.
Thank you for your help.
Greta

Hi Greta,

For Combo227 (you didn't post anything about Combo305), you have two columns
for the row source: [File Name] and [File Size]. To get the file size you
need to use the Column() property and referance the second column:

forms!YourForm!Combo227.Column(1)

The row source column count is zero based, so the second column ([File
Size]) is column 1.


In the after update event of Combo227, you created an object. You should add
two lines before the end sub:

rs.Close
Set rs = Nothing


Everything else is confusing me.... (since I can't see your database<g>). It
looks like there are 8 unbound combo boxes (in the form header?) and a
calculated(?) text box (Textbox221) that holds the jpg file name. And another
(calculated?) text box holds the fully qualified file name of the jpg.

Combo227 is bound to the (calculated?) control Textbox221, that changes the
form current record in the after update event, which seems to defeat the
purpose of having the combo box bound....(and might lead to data
confusion/corruption....)

Again, I can't see your database, so I am easily confused.... :-O

HTH
 
Top