Is there code available for filter by selection...?

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

I've seen just about everything I need in reference to
servertype filters and filterbyform, but nothing for
applying a filter by selection (if it's available and if
so, how it's used). I've even tried using
"DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, 1,
acMenuVer70" to trigger the event myself to no avail. I
receive an error that "the command or
action 'filterbyselection' is not available now". Is
there such an animal or am I just using it incorrectly? I
suspect the latter is the case. I appreciate any help
offered.

Thank you
 
If you are trying to put this into the Click event of a command button, when
you click the button *it* has focus, and naturally enough you cannot filter
by the selection in a command button.

You could try:
Screen.PreviousControl.SetFocus
RunCommand acCmdFilterBySelection

That's like to be flakey, e.g. if there was no previous control.
Probably easier to use the toolbar button, where the focus issue does not
come into it.
 
Thank you very much, Mr Browne. Maybe that's what I'll
do - just use the toolbar. It seems like too much of a
hassle to code it.
 
Back
Top