I would like to filter through my data with two text boxes, StaffTotalSearchText1 and StaffTotalSearchText2.
I understand that only the most recent DoCmd.ApplyFilter command appies, and that means I don't know how to apply two text filters.
Edit: Solution found - see Johnny's RecordSource code One way of applying a filter is to do it do the loaded data (RecordSource) - still allowing a "DoCmd.ApplyFilter" to be used.
I've created a "lock filter 1" button. When enabled, the filter applies; when disabled, there is no filter.
Johhny's answer has the correct code to filter the loaded data upon loading it.
Just use both values in filter and the same code in both filter events:
Edit: applying the second filter after the first:
If you want to use
RecordSource
you can use the same filter but must add the SQL for select command:Try this:
Assuming you're pointing to the correct objects (I'm guessing Forename is on a different form? It's the only one you're referencing by form name), this should work.