Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Unhappy Unanswered: Toggle a Form Filter

    Hello,

    I am trying to get a Command button to toggle the filter "on" and "off" on a form. I have done this by using:

    DoCmd.RunCommand acCmdToggleFilter

    How do I get this button to enable only if filter is on? I have tried several different things in the On Current event of the form, but to no avail, e.g.

    ================================================== ======
    Private Sub Form_Current()
    If ????? Then
    cmdFilter.Enabled = False
    Else
    cmdFilter.Enabled = True
    End If
    End Sub
    ================================================== ======

    Can anyone help?

    Rusty

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Not sure if the form current event is the best place for it but:

    Private Sub Form_Current()
    If Me.FilterOn Then
    cmdFilter.Enabled = False
    Else
    cmdFilter.Enabled = True
    End If
    End Sub

    also, you can extend the me.filteron to replace your docmd if you wish.
    Me.FilterOn = Not Me.FilterOn
    Cheers
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56
    Dear Pootle,

    That worked a treat!!

    Many thanks,

    Rusty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •