The information in this article applies to:
SUMMARY
Moderate: Requires basic macro, coding, and interoperability skills.
Instead, you must concatenate the value of Forms!Form1!Field1 into the criteria parameter as shown below:
This means that if the value of Forms!Form1!Field1 is "BEVR," the criteria parameter in the expression above would evaluate to:
MORE INFORMATION
When you make a function call such as
Access Basic internally creates a SQL statement with the parameters you supply. In this case, the resulting SQL statement is:
Access Basic sends this statement to the Access SQL engine, which returns the result of the SELECT statement back to Access Basic, and, in turn, back to your DLookUp() expression. Note that a DLookUp() coded as follows
would result in a WHERE clause that looks like:
The SQL parser is designed to accept SQL syntax, and the Forms!Form1!Field1 reference is Access Basic syntax, so the form reference cannot be expected to work. Instead, the resulting evaluated criteria parameter must be done in such a way as to accommodate the syntax rules of the SQL parser. Note that this also applies to other Access Basic methods and functions that require a criteria parameter. For example, Find methods use a criteria parameter as shown below:
REFERENCESMicrosoft Access "User's Guide", Version 1.0, page 181 and Appendix C Additional query words: concatenation
Keywords : kbprg |
Last Reviewed: March 18, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |