Subform filter (1 Viewer)

zgray

Registered User.
Local time
Yesterday, 20:57
Joined
Mar 8, 2013
Messages
55
I have a username combobox and a number combobox filtering a subform. If there is a userName but no number I want to pull all the records for that userName regardless of number and vice versa with a number and no userName. And if they both have something then both are being used for the filter.

I have been trying iff statments and isnull in query critera and cant seem to find what I need.
 

robina

Access Developer
Local time
Yesterday, 17:57
Joined
Feb 28, 2012
Messages
102
Instead of using a subform I would keep everything on one form. Put the comboboxes in the header. I am assuming the combo boxes are unbound. The record source for this form should be the query you are using to return records. In the query the criteria row for the userName field should have: [Forms]![formName]![usernameCombobox name] OR [Forms]![formName]![usernameCombobox name] Is Null

The same should be done for the number field, but reference the combobox for the number field on the form.
 

Users who are viewing this thread

Top Bottom