Export (0) Print
Expand All

Textual Criteria Expressions [Access 2003 VBA Language Reference]

Office 2003

To specify textual criteria for an operation, you supply a text string as part of the string expression that forms the criteria argument. This text string must be enclosed in single quotation marks (').

Note  The single quotation marks indicate to Microsoft Access that the criteria argument contains a string within a string.

Suppose that you are using the ADO Find method to find the first occurrence of a last name in an Employees table. You could construct the criteria argument as in the following example, which moves the current record pointer to the first record in which an employee's last name is Buchanan. Note that the string literal Buchanan is enclosed in single quotation marks and the entire string comprising the criteria argument must also be enclosed in double quotation marks (").

Dim rst As New ADODB.Connection

rst.open "Employees", CurrentProject.Connection,_
     dbOpenDynaset, adlockoptimistic)
rst.Find "[LastName] = 'Buchanan'"
		




Show:
© 2014 Microsoft