ACC2000: Custom Function Called by a Query Runs Multiple Times on a Computer Running Windows 2000 SP1 (304098)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q304098
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access database (.mdb).

SYMPTOMS

When you call a custom function from the criteria of a query, the function runs multiple times when it should run only one time.

CAUSE

This problem is caused by a bug in the Microsoft Jet database engine 4.0 that is included with Microsoft Windows 2000 SP1.

RESOLUTION

This problem has been fixed in the latest edition of the Jet Service Pack. For additional information about how to obtain the latest version of the Jet 4.0 database engine, click the following article number to view the article in the Microsoft Knowledge Base:

239114 How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine

NOTE: Always test updates thoroughly in a test environment before you distribute the update to your production environment.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
This problem has been fixed in the latest edition of the Jet Service Pack.

MORE INFORMATION

Steps to Reproduce the Behavior

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

  1. Install Windows 2000 SP1.
  2. Open the Northwind sample database.
  3. In the Database window, click Modules under Objects, and then click New.
  4. Create the following function:
    Function Test()
       Debug.Print "Testing the Function."
    End Function
    					
  5. Save the module.
  6. Create the following query and name it CustomersTest:
       Query: CustomersTest
       --------------------
       Type: Select Query
    
       Field: CustomerID
       Table: Customers
    
       Field: CompanyName
       Table: Customers
    
       Field: ContactName
       Table: Customers
       Criteria: =Test()
    					
  7. Run the CustomersTest query.
  8. Open the module that you created in step 3 in Design view.
  9. On the View menu, click Immediate Window. Note that "Testing the Function" appears multiple times in the Immediate window. It should appear only appear one time.

Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbprb KB304098