Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with SQL in VB (Access 2003)

    I'm using an SQL Query for a recordset (snapshot) in VBA. My SQL works fine in Access's query builder, but when inserting into VBA I get the error attached.
    Does anyone know why this is and if it's fixable?

    Thanks in advance for the help.
    Drew

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Problem with SQL in VB (Access 2003)

    A couple of possibilities - are you trying to include some sort of parameter in the SQL string - if so the use of " and ' may be causing problems. The other possibility is that you have a long line that has been separated with a carriage return so the second line of the query is what is causing the error. We would really need to see the section of VBA code where the SQL string is being constructed to help more. You can attach it as a text file, or you can embed it in a message.
    Wendell

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

    Re: Problem with SQL in VB (Access 2003)

    What is at the end of <code>(T_AgileData_Parsed.MFR_Clean) = "</code>
    ? A double quote or two single quotes? It should probably be two single quotes. You can also try to use 4 (four!) double quotes in succession: <code>(T_AgileData_Parsed.MFR_Clean) = """"</code>

  4. #4
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Problem with SQL in VB (Access 2003)

    Worked perfect.
    Thanks

Posting Permissions

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