ACC2000: ApplyFilter Action in a Macro Is Not Applied as Expected After You Install SR-1 (269380)
The information in this article applies to:
- Microsoft Access 2000 Service Release 1 (SR-1)
This article was previously published under Q269380 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
SYMPTOMS
When you test your custom filter, you notice that the filter is not applied as expected. The filter works correctly the first time, but every time after that, the filter is ignored.
CAUSE
You have installed Microsoft Office 2000 Service Release 1 (SR-1), and you are applying the filter in one of the following ways:
-
You are using a Where Condition in the ApplyFilter action of a macro.
-
You are setting an SQL Where clause as the source of the filter.
-
You are applying a Filter method in Visual Basic for Applications without first setting the filter to "".
-
You are applying the DoCmd.ApplyFilter method in Visual Basic for Applications.
RESOLUTION
To resolve this behavior, apply the filter with the Filter method by setting the filter first to nothing ("") and then to the filter that you want. For an example of how to do this, follow these steps:
- Open the sample database Northwind.mdb.
- Open the Customers form in Design view, and then add a combo box to the form. Set the following properties for the combo box:
Combo box
---------------------------------------------------------------------
Name: FilterCombo
RowSourceType: Table/Query
RowSource: SELECT [Customers].[CustomerID], [Customers].[CompanyName]
FROM [Customers]
ColumnCount: 2
ColumnWidths: 0";1"
- Set the AfterUpdate property of the combo box to the following event procedure:
'Setting the filter to nothing and back
'to the original filter insures that
'it is not lost.
Forms![Customers].Filter = ""
Forms![Customers].FilterOn = False
Forms![Customers].Filter = "[CustomerID] = '" & _
Forms![Customers]![FilterCombo] & "'"
Forms![Customers].FilterOn = True
- Save the form and open the form in Form view. Select several different items from the combo box, and note that the filter performs as expected.
NOTE: You can only resolve this behavior by using Visual Basic for Applications (VBA), as demonstrated in the previous example. You cannot resolve this issue by using a macro.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 1/10/2001 |
---|
Keywords: | kbbug KB269380 |
---|
|