Combo Boxes

lansel

Registered User.
Local time
Today, 17:08
Joined
Jul 2, 2003
Messages
72
Thanks for all the help for creating combo boxes. Now I have come up with something I don't know how to do.

I have two tables; tblAssociate which has two columns "Site" and "Associates. There are 7 different sites and I have creating cascading combo boxes after selecting the site, the associates for that site are listed.

The other table is tblequipment which has two columns "Site" and "Equipment". It has the same 7 sites and when I select the site, it will list the equipment at the selected site.

But, I don't want the site to have to be selected the second time. The form has other text boxes and combo boxes but these are the only two that pertain to the site. Can I just have the site selected one time on the form and it bring up the associates and equipment to be selected for that site?

Thanks,
 
Yeah you can have one combo box that selects the site, and have both combo boxes' row source set as shown below. Assuming your form's name is myFormName and your site combo box is cmbSite

Code:
SELECT * FROM tblAssociates WHERE site = forms!myFormName!cmbSite

Then all you'd have to do would be to requery the two combo boxes every time the cmbSite is updated/changed.
 
You should be able to - how are you executing the existing combo box filter? Do you have a WHERE clause set up in your rowsource of the combo boxes or are you running code behind on the After_Update event of your site combo box. I'm not sure why you would have to select site again? If you have one combo box for site just apply that site to both Associates and Equipment.
 
Thanks for your reply.

I am having problems with the requery part.

I have the following as the requiry for the first combo box where I want the site selected.

Private Sub ComboSite_AfterUpdate()
Me.ComboOperator.Requery
End Sub

How do I do the requiry for the ComboEquip if I am using the ComboSite? I have the drop down boxes working, but it doesn't requery. It is not allowing me to put in

Private Sub ComboSite_AfterUpdate()

twice.

Thanks!
 
Sorry, I didn't answer all the questions.

I am setting up the combo boxes with queries. I am using the WHERE clause in the Associate query: [Forms]![FormEntry]![ComboSite].

In the other equipment combo box, I am using a query with the WHERE clause the same.

The combo box for the Associates is working correctly with the requery. The combo box for equipment is allowing me to select but it is not requerying. Apparently I am not entering the right information in the AfterUpdate.

Thanks for your help.
 
I finally got my cascading combo boxes to work. I figured out how to do it after spending part of yesterday and today reading all the posts on cascading combo boxes and looking at the samples.

Thanks for all the help I received.
 

Users who are viewing this thread

Back
Top Bottom