Unable to filter records using a command button

T

Tommy Keenze

I have an MS Access 2003 database with 1,126 records of members in an organization. The records contain a field named strStatus in which some members are identified as “Active†and some as “Deceasedâ€, etc. There are 276 “Active†records.

I created a command button on the form that executes a macro. The macro command is “ApplyFilterâ€, and the Filter Name control contains the name of the underlying query: qselActiveMembers. The query produces correct results when executed directly, and the command button executes the macro. However, the database still shows all 1,126 records.

Similarly, I created a button to limit records to those with a checked option box. The underlying query for this macro works perfectly also, but not when executed thru the command button on the form.

I would be grateful for any suggestions to solve this rather perplexing problem.
 
S

Steve Schapel

Tommy,

Do you have the your 1126 records displayed in a subform, or is it a
continuous view form which is not a subform on another form?
 
T

Tommy Keenze

The command button is on the main form, but there are subforms on it as well.

Something I have not identified has changed. I have had these filter buttons working until recently. The subforms have never been a problem in the past. Perhaps there is something about the 2003 version that is different from the 2000 version.
 
T

Tommy Keenze

The records are on a main form, however there are
subforms for addresses and contact information. These
have not been a problem in the past. I have been fine-
tuning this database program since v 1.0. Don't know what
has chenged recently that caused this problem to appear.
 
T

Tommy Keenze

Thank you very much, Peter. I had to modify the code to read:

Me.Filter = "strStatus = 'Active'"

But adding the Me.FilterOn = True apparently did the magic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top