• Syntax help please with str SQL statement

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Syntax help please with str SQL statement

    Author
    Topic
    #496035

    A button on my Quote form (frmQuotes) causes a maketable query to run. The created table is then read to provide data for creating a word document. This all currently works fine.

    I am out to streamline the database and wish to replace the created table with a dbs.OpenRecordset(strSQL) function

    The (maketable)query SQL is

    Code:
    SELECT tblQuotes.*, REPS.FullName, REPS.Title, REPS.Email, tblQuotes.QuoteNum
    FROM tblQuotes INNER JOIN REPS ON tblQuotes.RepID = REPS.ID
    WHERE (((tblQuotes.QuoteNum)=[Forms]![frmQuotes]![QuoteNum]));
    

    and I have tried converting it to

    Code:
    strSQL = “SELECT tblQuotes.*, REPS.FullName, REPS.Title, REPS.Email, tblQuotes.QuoteNum ” & _
    “FROM tblQuotes INNER JOIN REPS ON tblQuotes.RepID = REPS.ID ” & _
    “WHERE (((tblQuotes.QuoteNum)=[Forms]![frmQuotes]![QuoteNum]));”
    

    but I get

    Error 3061 Too few parameters 1 expected

    Once again, where have I gone wrong? I never seem to be able to get these right!

    Thanks in advance,

    Viewing 0 reply threads
    Author
    Replies
    • #1464452

      Try this:

      Code:
      strSQL = “SELECT tblQuotes.*, REPS.FullName, REPS.Title, REPS.Email, tblQuotes.QuoteNum ” & _
      “FROM tblQuotes INNER JOIN REPS ON tblQuotes.RepID = REPS.ID ” & _
      “WHERE (((tblQuotes.QuoteNum)=” & [Forms]![frmQuotes]![QuoteNum]
      
    Viewing 0 reply threads
    Reply To: Reply #1464452 in Syntax help please with str SQL statement

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

    Your information:




    Cancel