Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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

↑ Back to the top


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.

↑ Back to the top


Status

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

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: KB228641, kbdocerr, kbdta, kbbug, kberrmsg

↑ Back to the top

Article Info
Article ID : 228641
Revision : 1
Created on : 12/12/2002
Published on : 12/12/2002
Exists online : False
Views : 315