Muokkaa

Jaa


Filtering Items Using a Variable

Use values from variables as part of a filter in Microsoft Jet syntax or DAV Searching and Locating (DASL) syntax. The following example illustrates the use of variables as part of a filter:

fullname = "Dan Wilson" 
' This approach uses Chr(34) to delimit the value.  
criteria = "[FullName] = " & Chr(34) & fullname _ & Chr(34) 
' This approach uses the double quotation mark to delimit the value.  
criteria = "[FullName] = """ & fullname & """" 
' This approach uses the escaped hexadecimal value of the double quotation mark to delimit the value.  
criteria = "[FullName] = "%22" & fullname & "%22"" 

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.