• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 121
  • Last Modified:

Setting Filters in ACCESS Form

Data Entry FormHi,
 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
0
sglee
Asked:
sglee
  • 3
  • 3
1 Solution
 
Rgonzo1971Commented:
HI,

pls try

Private Sub ShowActive_Click()
 DoCmd.ApplyFilter , "Active = 'Y'"
 End Sub

 Private Sub ShowInActive_Click()
 DoCmd.ApplyFilter , "Active = 'N'"
 End Sub

 Private Sub FilterOff_Click()
 Me.FilterOn = False
 End Sub

Open in new window

Regards
0
 
sgleeAuthor Commented:
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
0
 
Rgonzo1971Commented:
You say the field is named Active not Status
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
sgleeAuthor Commented:
Sorry, it should have been "ACTIVE".

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

Me.Filter = "Active =  'N'"
Me.FilterOn = True
0
 
Rgonzo1971Commented:
Does it work then?
0
 
sgleeAuthor Commented:
Yes it worked. I don't know what I was doing ...
Thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now