add a second click event statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top