Filter combo box from another field

branston

Registered User.
Local time
Today, 05:55
Joined
Apr 29, 2009
Messages
372
Hi,

I have a form with a combo box on. I have set this combo box to look up its records from a query. In the query there are 2 columns. I was wondering if there was a way to filter the combo box to only show records where the 2nd column equals another field on the form.

For example, The query has 2 columns, Surname & Month. The form has a combo box and another box showing Month. If you use the drop down menu, I want it to only show Surname options where when Month fields are equal.

Does that make any sense?!

I have something which sort of works, but it only shows the drop down options for the 1st record (i.e. where the month in the query matches the month on the 1st record) and doesn't change as I move through the records.
For that I have the row source as:
SELECT [QryUnused].[Surname] FROM QryUnused WHERE QryUnused.Month=[comboMonth];

Any ideas?

Thank you
 
You need to go into the VBA Editor and Add
ComboboxName.Requery

I would add the code to the "on change" event of your comboMonth
and to the "On Current" event of the form. Which will requery your combo box on every record change. Which forces it too recheck the value of your comboMonth.
 
That's brilliant - Thank you for your help!
 

Users who are viewing this thread

Back
Top Bottom