sglee
asked on
Setting Filters in ACCESS Form
Hi,
I have a form in ACCESS where users enter/update store information. In that I have a field called "ACTIVE" which is a character/string field with 1 in length. (It is not a Y or N field). If the store is active, it has 'Y'. If the store is inactive, it has 'N'.
I created three radio buttons on the form, but the only button that works is "Display All Stores". What am I doing wrong?
Private Sub ShowActive_Click()
DoCmd.ApplyFilter , "Status = 'Y'"
Me.FilterOn = True
Forms!
End Sub
Private Sub ShowInActive_Click()
DoCmd.ApplyFilter , "Status = 'N'"
Me.FilterOn = True
End Sub
Private Sub FilterOff_Click()
Me.FilterOn = False
End Sub
I have a form in ACCESS where users enter/update store information. In that I have a field called "ACTIVE" which is a character/string field with 1 in length. (It is not a Y or N field). If the store is active, it has 'Y'. If the store is inactive, it has 'N'.
I created three radio buttons on the form, but the only button that works is "Display All Stores". What am I doing wrong?
Private Sub ShowActive_Click()
DoCmd.ApplyFilter , "Status = 'Y'"
Me.FilterOn = True
Forms!
End Sub
Private Sub ShowInActive_Click()
DoCmd.ApplyFilter , "Status = 'N'"
Me.FilterOn = True
End Sub
Private Sub FilterOff_Click()
Me.FilterOn = False
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You say the field is named Active not Status
ASKER
Sorry, it should have been "ACTIVE".
Me.Filter = "Active = 'Y'"
Me.FilterOn = True
Me.Filter = "Active = 'N'"
Me.FilterOn = True
Me.Filter = "Active = 'Y'"
Me.FilterOn = True
Me.Filter = "Active = 'N'"
Me.FilterOn = True
Does it work then?
ASKER
Yes it worked. I don't know what I was doing ...
Thanks for your help.
Thanks for your help.
ASKER
Now I tried the following also, but did not work. Can you explain?
Me.Filter = "Status = 'Y'"
Me.FilterOn = True
Me.Filter = "Status = 'N'"
Me.FilterOn = True