Reputation: 459
I'm creating a navigation form where some of the navigation buttons simply apply filters to the subform. Problem is right now each option is exclusive, i.e. I can select staff either by branch OR by job title. How can I make the options NOT exclusive so that I can apply multiple filters at once?
EDIT just to add. I have no knowledge of VBA so I'm trying to do this using the graphical interface and of macros. If it can't be done using these tools then fine, I'll find a different solution.
Upvotes: 0
Views: 178
Reputation: 11781
This solution requires a moderate amount of VBA (I can't think of a solution that wouldn't require it). Store the user's choices in module level variables and then apply your filters using a master ApplyFilters
subroutine.
For example, give each checkbox an AfterUpdate event. This event will do 2 things:
Since all the user's choices are now stored in module level variables, the ApplyFilters can see them all. It will:
1=1
)Other notes: Accessing your subform's controls from the main form is simple. To change your subform's filter to the string NewFilter, try:
Forms!MyMainFormsName!MySubFormsName.Filter=NewFilter
Upvotes: 1
Reputation: 123549
If you replace the .Filter
property on a form (or subform) with a new value then the previous filter goes away. If you append a new clause onto an existing .Filter
string, e.g. by changing...
[Branch]="Main"
...to...
[Branch]="Main" AND [Title]="Manager"
...then the new filter applies both criteria.
Upvotes: 1