Textual criteria expressions

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 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'"

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.