can I add a "Filter By Selection" button?

J

JWCrosby

Is it possible to include command buttons on a form that perform the same
routine as the FilterBySelection and RemoveFilter icons in the toolbar do?
(Two command buttons, not one!) I'd like to do this rather than to reference
users to the toolbar.

Of course, if it's possible I'd like to know how to do it.

Thanks in advance.
 
O

Ofer Cohen

Try this code

' The field is loosing it focus when you press the button, so you need to
move back to the control
Screen.PreviousControl.SetFocus
' Run the Filter
RunCommand acCmdFilterBySelection
 
J

JWCrosby

Thanks, Ofer. That works with a form set to "single form" view, but doesn't
with a form set to "continuous forms" view. Probably because (in my feeble
thinking!) because the cursor wasn't previously at a "control".

Any suggestions for how to add a button on a continuous forms view form that
will accomplish the same thing (i.e., filter by selection)?

Jerry
 
O

Ofer Cohen

I tried it in a continous form and it works, when the button on the form, or
on the form footer.

Do you get an error?
If so, what is it?
 
J

JWCrosby

Funny thing, but I went back to it, without having changed anything, and it's
working! Hey, it's a computer, right?

Thanks for your help!

Jerry
 
Top