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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table lookup based on selected criteria in combo box

Status
Not open for further replies.

rhinomac

Programmer
Jan 24, 2003
34
US
-I have a form with two combo boxes's.

-The first cbox I want the user to be able to select a mfg from a drop down list of three choices linked to a mfg table.

-Once that mfg is selected then i want the 2nd cbox to only display the data from a model table that is linked to the intial selection in the mfg cbox.

-I have tried dlookups, select statements and linked queries. Now im just lost...
Does anybody have any suggestions on the best and most effecient way to do this..
Your help would be greatly appreciated.
-Rhino

Facts:
2 tables(mfg, model)
1 form (enter-mfg-and-model)
2 cboxes on form (model and mfg)
the model and mfg table have primary keys (mfg_id, model_id)
the model table also has a column that has the mfg id in it to identify the relationship.
 
Your second combo box should have a query that uses the value of the first combo in it's criteria. When the first one changes it should call the requery method for the second combo. This should work:

Sub MyCombo_afterupdate()
Dim ctlCombo As Control

' Return Control object pointing to combo box.
Set ctlCombo = Forms!myForm!ComboBox2

' Requery source of data for combo box.
ctlCombo.Requery

End Sub

Or you can just use

Forms!myForm!ComboBox2.requery







 
That sounds good but, how do i have the second combo query use the value of the first combo selection.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top