• Problem with SQL in VB (Access 2003)

    Author
    Topic
    #425678

    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

    Viewing 1 reply thread
    Author
    Replies
    • #981430

      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.

    • #981431

      What is at the end of (T_AgileData_Parsed.MFR_Clean) = "
      ? 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: (T_AgileData_Parsed.MFR_Clean) = """"

    Viewing 1 reply thread
    Reply To: Problem with SQL in VB (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: