Link to home
Start Free TrialLog in
Avatar of animallover
animallover

asked on

combo box w/criteria in the row source to show all previous entries even when the criteria doesn't match

I have an Access 2010 database with a combo box in a subform that is in datasheet view.  In the row source of the combo box I have a query that limits the entries in the combo box based on criteria that it gets from the main form.  This part works correctly.  The problem I am having is that previous records in the datasheet subform don't show the entries in the combo box field if the criteria in the current record doesn't match.  For example:  the main form has a field called "Origin".  This data may change or it may stay the same depending on the unique circumstances of the record.  In the combo box on the subform I tell it it to look at the data in the "Origin" field and filter the set of data that populates in the combo box according to the data.  Because "Origin" can change, the entries that show up in the combo box changes too.  When this happens all the records with that combo box field are blank.  Help, please.
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

This is done using the OnEnter and OnExit events of the combobox:

  OnEnter, set the filter as you do now for the current record.
  OnExit, remove the filter so all options will be showed.

/gustav
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of animallover
animallover

ASKER

Thank you.   This is exactly what I was looking for.