Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL Statement wrong (MSACCESS 2003)

    I have a line in a query that reports an error in syntax.

    Mysql = Mysql & " WHERE (((SubDirectorySubDocs.SD1) Like "*.doc"))

    Anyone see whats missing or wrong. Many thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SQL Statement wrong (MSACCESS 2003)

    If you want to use quoted strings within a quoted string, you can't just use double quotes " - it confuses VBA because it sees the " as the beginning or end of a string. One workaround is to use single quotes:
    <code>
    Mysql = Mysql & " WHERE SubDirectorySubDocs.SD1 Like '*.doc'"
    </code>
    See <!post=Chr() function and quotes within strings (all),230516>Chr() function and quotes within strings (all)<!/post> for background info and other options.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL Statement wrong (MSACCESS 2003)

    Many thanks. Happy New Year.

Posting Permissions

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