Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AdvancedFind (VBA / Outlook / XP)

    I'm using the Advanced Search method to find emails with a string somewhere in the body of the email. It is working fine, except when the search term is something like "Jones and Jones" - the search string must get confused with the "and" and the LIKE business. Here is the string I pass to AdvancedSearch as the filter:
    strF = "urn:schemas:httpmail:subject LIKE '%" & vSearchTerm & "%' or urn:schemas:httpmail:textdescription LIKE '%" & vSearchTerm© & "%'"
    It fails when vSearchTerm = "Jones and Jones"
    Should I somehow include quotes in the variable? Or enter them in the strF string?
    THANKS SO MUCH!

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: AdvancedFind (VBA / Outlook / XP)

    Try single quotes in the mutliple word variable, such as

    vSearchTerm = 'Jones and Jones'

    You might want to build the surrounding single quotes with Chr(39). Such as (air code):

    strUserEntry = InputBox("Look for What? ", "Search Me!")
    vSearchTerm = Chr(39) & strUserEntry & Chr(39)

    Post back if this doesn't help.
    -John ... I float in liquid gardens
    UTC -7±DS

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Los Angeles
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AdvancedFind (VBA / Outlook / XP)

    John
    Thanks for the tips. For some reason, it is now searching the string properly without having to add quotes.
    David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •