Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query options displayed through combo box using code.

Status
Not open for further replies.

hrg

Programmer
Jan 8, 2009
46
0
0
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top