Full Version: 'Filter by selection' and 'remove filter'
UtterAccess Forums > Microsoft® Access > Access Forms
markmcrobie
These are 2 buttons on the standard toolbar, but I want them as command buttons on my form. However the wizard for creating a command button doesn't include these options.
Any ideas?
Peter46
The wizard does include FilterBy selection.
However, the code produced by FilterBySelection doesn't work.
You can use:
Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdFilterBySelection
To remove the filter use:
DoCmd.RunCommand acCmdRemoveFilterSort
markmcrobie
Thanks a lot.
Why doesn't the code work with the wizard?
markmcrobie
In my version of Access (97), the available Categories in the wizard are:

Record Navigation
Record Operations
Form Operations
Report Operations
Application
Miscellaneous

Only Form Operations mentions filters. Available are:

Apply Form Filter
Edit Form Filter

Is one of these the same as Filter by Selection?
Peter46
OK - maybe FilterByException came later - I didn't know that.
But it doesn't work because it doesn't put the focus back onto the control that has just lost focus to get to the button.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.