Query performance decreases when the criteria in a Microsoft JET 4.0 query contains a user-defined function (821936)
The information in this article applies to:
- Microsoft Access 2002
- Microsoft Access 2000
SYMPTOMS The performance of a query that is run against an Open
Database Connectivity (ODBC) data source may significantly decrease if the
query contains a user-defined function. CAUSE This problem may occur when all the following conditions
are true:
- The query is run against an ODBC data source.
- The query contains a user-defined function in the WHERE
clause.
- The function returns a different data type than the data
type of the column that the function is compared to.
WORKAROUNDTo work around this problem, make the user-defined function
return the same data type as the column in the WHERE clause. If you do not
declare the data type, the function returns the default Variant data type. For example, the following function returns the
default Variant data type:
Function EnterQuantity(intVal As Integer)
EnterQuantity = intVal
End Function
To modify the default Variant data type to Integer, use the following function:
Function EnterQuantity(intVal As Integer) As Integer
EnterQuantity = intVal
End Function
STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
in the "Applies to" section of this article.
Modification Type: | Minor | Last Reviewed: | 8/6/2004 |
---|
Keywords: | kbPerformance kbtshoot kbBug KB821936 kbAudDeveloper |
---|
|