R
Ray C
This may sound basic but I am a beginer. I have 4 Combo Boxes set up to make
selections on 4 different fields of a table dependong on how the user wants
to search the Table, they are called cmb_Find_Box_1 to cmb_Find_Box_4. In
order to search the table, I need to know which Fieald the user wants to
search and which Record the user wants to find.
I use the after_Update event to send a number to a proccessing routine as
follows :-
Private Sub cmb_Find_Box_1_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(1): End Sub
Private Sub cmb_Find_Box_2_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(2): End Sub
Private Sub cmb_Find_Box_3_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(3): End Sub
Private Sub cmb_Find_Box_4_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(4): End Sub
Thereby the Number of the selected Combo gets sent to the sub
"cmb_Find_Box_AfterUpdate" in the form of an Integer called "Findbox" and the
routine knows which field to search but also needs to know which record to
look for. This information is stored in the appropiate Combo box in the form
so I currently use the following to get that information into a string called
"Box" :-
If Findbox = 1 Then Box = [Cmb_Find_Box_1]
If Findbox = 2 Then Box = [cmb_Find_Box_2]
If Findbox = 3 Then Box = [cmb_Find_Box_3]
If Findbox = 4 Then Box = [cmb_Find_Box_4]
Surely there must be a way to write this in one line?
Something like Box = 'the contents of the combo identified by the number
held in the integer "FindBox"'
Could anyone help?
thanks Ray C
selections on 4 different fields of a table dependong on how the user wants
to search the Table, they are called cmb_Find_Box_1 to cmb_Find_Box_4. In
order to search the table, I need to know which Fieald the user wants to
search and which Record the user wants to find.
I use the after_Update event to send a number to a proccessing routine as
follows :-
Private Sub cmb_Find_Box_1_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(1): End Sub
Private Sub cmb_Find_Box_2_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(2): End Sub
Private Sub cmb_Find_Box_3_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(3): End Sub
Private Sub cmb_Find_Box_4_AfterUpdate(): Call
cmb_Find_Box_AfterUpdate(4): End Sub
Thereby the Number of the selected Combo gets sent to the sub
"cmb_Find_Box_AfterUpdate" in the form of an Integer called "Findbox" and the
routine knows which field to search but also needs to know which record to
look for. This information is stored in the appropiate Combo box in the form
so I currently use the following to get that information into a string called
"Box" :-
If Findbox = 1 Then Box = [Cmb_Find_Box_1]
If Findbox = 2 Then Box = [cmb_Find_Box_2]
If Findbox = 3 Then Box = [cmb_Find_Box_3]
If Findbox = 4 Then Box = [cmb_Find_Box_4]
Surely there must be a way to write this in one line?
Something like Box = 'the contents of the combo identified by the number
held in the integer "FindBox"'
Could anyone help?
thanks Ray C