ACC2000: Access Help for the ApplyFilter Action or Method Is Incorrect About the Third Argument (228641)



The information in this article applies to:

  • Microsoft Access 2000

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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Open the sample database Northwind.mdb.
  2. 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
    					
  3. On the Debug menu, click Compile Northwind. Note that the code that you entered into the module generates no errors during the compile process.
  4. Change the following line of code
        DoCmd.ApplyFilter , "Country = 'USA'"
    					
    to:
        DoCmd.ApplyFilter , "Country = 'USA'", acFilterNormal
    					
  5. 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.

REFERENCES

For more information about the ApplyFilter method, click Microsoft Visual Basic Help on the Help menu, type applyfilter method in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

For more information about the ServerFilter or ServerFilterByForm properties, click Microsoft Visual Basic Help on the Help menu, type serverfilter property in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Modification Type:MajorLast Reviewed:12/12/2002
Keywords:kbbug kbdocerr kbdta kberrmsg KB228641