Microsoft KB Archive/228641

= ACC2000: Access Help for the ApplyFilter Action or Method Is Incorrect About the Third Argument =

Article ID: 228641

Article Last Modified on 12/12/2002

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q228641



This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
Access Help states that the ApplyFilter action and method has three arguments. However, there is no way to enter the FilterType argument in a macro, and you receive following compile error when you use the FilterType argument in Visual Basic for Applications code:

Compile error:

Wrong number of arguments or invalid property assignment



RESOLUTION
If you want to apply a normal, or default, client-side filter in the ApplyFilter method, just exclude the third argument of the ApplyFilter method. However, if you want to apply a server-side filter, use the ServerFilter and ServerFilterByForm properties in place of the ApplyFilter method.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb.  Create a new module named Module1, and then enter the following code into the module: Option Compare Database Option Explicit

Sub Test DoCmd.OpenForm "Customers" DoCmd.ApplyFilter, "Country = 'USA'" End Sub  On the Debug menu, click Compile Northwind. Note that the code that you entered into the module generates no errors during the compile process.  Change the following line of code DoCmd.ApplyFilter, "Country = 'USA'" to: DoCmd.ApplyFilter, "Country = 'USA'", acFilterNormal  to: On the Debug menu, click Compile Northwind. Note that you receive the error message that is mentioned in the "Symptoms" section of this article.</li></ol>

<div class="references_section">