View Full Version : Update Combo Box 2 from Combo Box 1


Nicola
08-09-2001, 05:06 AM
I have a table (SiteTable) which contains a list of all sites. I have another table (RecieptsTable) which contains a list of suppliers for each site.

Combo box 1 allows me to select a site using SiteTable as the record source.

From ReceiptsTable I want Combo box 2 to then present the user with a list of all suppliers to the site that has been selected in combo box 1.

I have a query which does this. i.e. when I select a site in combo box 1 and then run the query from the database window it lists all suppliers associated with that site, but when I click on combo box 2 (whose record source is the query) it doesn't work. Or rather it does work, but it doesn't change the suppliers listed in combo box 2 when the site selection in combo box 1 changes.

I have searched through this forum but can't find the answer to my problem.

Any advice would be greatly appreciated!

Angello Pimental
08-09-2001, 05:17 AM
Nicola, you need to requery combobox2.

So put:

Me!combobox2.requery

In the after_update of combobox1.

HTH

Angelo

Nicola
08-09-2001, 05:27 AM
Brilliant, excellent, fantastic!

Thank you very much.

Nicola

Pat Hartman
08-09-2001, 10:56 AM
You also need to requery the combobox in the OnCurrent event of the Form to make sure that the second combobox is in sync with the first even when the first did not change.

Me.combobox2.requery