I have a database that was designed in Access 2000. However, my firm recently upgraded to Access 2007, and I'm having difficulty with one of the macros I created that had worked in the older version.
In the 2000 version of the database, I have a button on a form that runs a macro on the 'on-click' event containing the following commands:
1. ShowAllRecords
2. RunCommand: RemoveFilterSort
3. ApplyFilter: qryFindAPN
What this is supposed to do, is to clear any existing filter and run a query named qryFindAPN. qryFindAPN queries a single field and has a criteria setting that prompts the user to enter data - in this case an Assessors Parcel Number (APN). The intent is that the user can use this button as many times as they need to, to query records without closing and reopening the form. The on-click event and macro work just fine in Access 2000/2003.
In Access 2007, however, the macro will run once successfully. Thereafter, it simply reapplies the previous filter - even after clearing to show all records - and does not give the user a prompt for data input.
I searched the forums on my own to attempt to find a solution to this problem. All references point to the use of the following code to solve the problem:
Me.FilterOn = False
Me.Filter = ""
Going with this, I replaced the prior macro in the on-click event with the following:
Me.FilterOn = False
Me.Filter = ""
DoCmd.ApplyFilter "qryFindAPN"
Unfortunately, this script is producing the same results as the macro. It will run successfully the first time after the form has been opened - prompting the user for an APN - but thereafter will just reapply the prior filter, even thought the FilterOn and Filter="" statements appear to be running correctly.
Could someone tell me what it is I'm doing wrong here?
Thanks,
Chris
In the 2000 version of the database, I have a button on a form that runs a macro on the 'on-click' event containing the following commands:
1. ShowAllRecords
2. RunCommand: RemoveFilterSort
3. ApplyFilter: qryFindAPN
What this is supposed to do, is to clear any existing filter and run a query named qryFindAPN. qryFindAPN queries a single field and has a criteria setting that prompts the user to enter data - in this case an Assessors Parcel Number (APN). The intent is that the user can use this button as many times as they need to, to query records without closing and reopening the form. The on-click event and macro work just fine in Access 2000/2003.
In Access 2007, however, the macro will run once successfully. Thereafter, it simply reapplies the previous filter - even after clearing to show all records - and does not give the user a prompt for data input.
I searched the forums on my own to attempt to find a solution to this problem. All references point to the use of the following code to solve the problem:
Me.FilterOn = False
Me.Filter = ""
Going with this, I replaced the prior macro in the on-click event with the following:
Me.FilterOn = False
Me.Filter = ""
DoCmd.ApplyFilter "qryFindAPN"
Unfortunately, this script is producing the same results as the macro. It will run successfully the first time after the form has been opened - prompting the user for an APN - but thereafter will just reapply the prior filter, even thought the FilterOn and Filter="" statements appear to be running correctly.
Could someone tell me what it is I'm doing wrong here?
Thanks,
Chris