Filtering Items Using a Variable

Outlook Developer Reference

You can 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""

See Also