add a second click event statement

S

smcgart

I've created a form with a subform and added a command button that turns on a
filter. I want to turn the filter off by clicking the same button again.
I'm not very strong in Visual Basic, and have spent three days trying to make
this happen. Can anyone help?
 
S

smcgart

Thank you so much, it's working fine.
S

Wayne Morgan said:
A couple of options:

1) Use a Toggle Button instead of a Command Button. In the Click event set
the FilterOn property equal to the Toggle Button's Value.

Example:
Me.Subform.Form.FilterOn = Me.Toggle0.Value

2) Set the FilterOn to the opposite of its current value in the Command
Button's Click event.

Example:
Me.Subform.Form.FilterOn = Not Me.Subform.Form.FilterOn

Option one may be better because you can tell by the button whether the
filter is on or off.
 
Top