Filter with a checkbox

wrweaver

Registered User.
Local time
Today, 00:03
Joined
Feb 26, 2013
Messages
75
I'm trying to filter a continuous form with a filter using a checkbox where when you check the checkbox it applies the filter and when you uncheck it, the filter is taken off and all records are shown. But I can't get the check = false to take the filter off.

Private Sub Check19_AfterUpdate()
If Check19 = True Then

DoCmd.ApplyFilter , "[ContractActive] = True"
If Check19 = False Then
Exit Sub
End If
End If
End Sub
 
Does it become more obvious with the code indented?

Code:
  If Check19 = True Then

    DoCmd.ApplyFilter , "[ContractActive] = True"
    If Check19 = False Then
      Exit Sub
    End If
  End If

You want an Else clause in the first If, not another If.
 
Ohhh. Yeah, but that doesn't undo the filter. Even unchecked, the filter is still on.
 
No, you have to undo it in the Else clause. I haven't used that method to filter, but try

Me.FilterOn = False
 
Annnnnnd success. Again, pbaldy saves the day. Thank you!
 

Users who are viewing this thread

Back
Top Bottom