Full Version: add a "filter For:" field to the toolbar
UtterAccess Forums > Microsoft® Access > Access Forms
weissbook
How can I add to the custom toolbar a "filter For:" button/field ?
(the app is run in a runtime environment, so there is no right click context menu.)
IA
LPurvis
Can't be sure it'll work with the runtime (for example Filter-By-Form functionality is removed under the Runtime... no serious loss IMHO ;-).
However if Filter For is still functional - you can copy the menu control to your custom control.
One manual method could be
Show your custom Toolbar.
Right click - select Customize.
On the toolbars tab - check the Shortcut Menus.
Then on the bar that appear click on Form > Form View Control.
You'll then see the shortcut menu you'd normally see.
If you hold click on, and drag the Filter By control onto your custom toolbar it will be moved there. (Not ideal).
If you do the drag and drop while holding down the control key - it will *copy* the control instead. (Which is what you want to do).
I've tested quickly and the functionality of the control is preserved from a toolbar just as it would from the shortcut menu.
Were it not, for whatever reason - such as the runtime, then you could code your own filtering routine to replace it (considerably more effort though of course :-)
weissbook
Cool... seems like it's working... a friend is testing it right now on a runtime environment.
If course if I would have rea all the way through, I wouldn't have removed the field from the context menu... (I didn't hold down the control button...)
<
True, the only issue is the filtering could be on any of the ~50 fields on the form, so I would have to implement a listener to define what field had focus the last...
Thanks!
LPurvis
I do expect it to work under runtime - as I've never heard it explicitly stated that it doesn't. (Unlike FBF - blurgh!)
(I can test if need be - if your friend doesn't get back to you).
Is for implementing your own - because commandbars don't remove focus from the form you're working on - you could test on the ActiveForm and ActiveControl methods - and check the controlsource and determine what to filter by that way.
Not a big job in itself - just much greater than copying an existing men option's functionality ;-)
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.