Link to home
Start Free TrialLog in
Avatar of sglee
sglee

asked on

Setting Filters in ACCESS Form

User generated imageHi,
 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
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sglee
sglee

ASKER

Worked like a charm! Thank you.

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
You say the field is named Active not Status
Avatar of sglee

ASKER

Sorry, it should have been "ACTIVE".

Me.Filter = "Active =  'Y'"
Me.FilterOn = True

Me.Filter = "Active =  'N'"
Me.FilterOn = True
Does it work then?
Avatar of sglee

ASKER

Yes it worked. I don't know what I was doing ...
Thanks for your help.