Hello there
I am trying to show some query results in a combo box by using code. The only problem i am having is that i get mismatch type errors and then when it works it shows the line of code in the box (Instead of being in the drop down menu)! How do i get the code to tell the combo box to show the query results (so it can be used like a drop down menu). I know i can use record source in the properties box but thats not what i want as the combobox displays will change depending on the criteria selected else where.
My code is below
Private Sub CmbType_Exit(Cancel As Integer)
If CmbType = "Adult" Then
CmbSize!RecordSource = "SELECT * FROM Adult_Size "
CmbTShirt!RecordSource = "SELECT * FROM Adult_TShirts "
Else
If CmbType = "Child" Then
CmbSize!RecordSource = "SELECT * FROM Child_Size "
CmbTShirt!RecordSource = "SELECT * FROM Child_TShirts "
Else
CmbSize! = "SELECT * FROM Infant_Size "
me!RecordSource!CmbTShirt = "SELECT * FROM infant_TShirts "
End If
End If
End Sub
Key :-
cmb... = combobox
_size = Query
_Tshirts = Query
As you can see the last statement is what i have been experimenting with but had no luck.
Please can anyone help.
Thanks
I am trying to show some query results in a combo box by using code. The only problem i am having is that i get mismatch type errors and then when it works it shows the line of code in the box (Instead of being in the drop down menu)! How do i get the code to tell the combo box to show the query results (so it can be used like a drop down menu). I know i can use record source in the properties box but thats not what i want as the combobox displays will change depending on the criteria selected else where.
My code is below
Private Sub CmbType_Exit(Cancel As Integer)
If CmbType = "Adult" Then
CmbSize!RecordSource = "SELECT * FROM Adult_Size "
CmbTShirt!RecordSource = "SELECT * FROM Adult_TShirts "
Else
If CmbType = "Child" Then
CmbSize!RecordSource = "SELECT * FROM Child_Size "
CmbTShirt!RecordSource = "SELECT * FROM Child_TShirts "
Else
CmbSize! = "SELECT * FROM Infant_Size "
me!RecordSource!CmbTShirt = "SELECT * FROM infant_TShirts "
End If
End If
End Sub
Key :-
cmb... = combobox
_size = Query
_Tshirts = Query
As you can see the last statement is what i have been experimenting with but had no luck.
Please can anyone help.
Thanks