Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    309
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Syntax help please with str SQL statement

    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,
    "Heading for the deep end"

  2. #2
    Administrator
    Join Date
    Jun 2010
    Location
    Portugal
    Posts
    10,272
    Thanks
    130
    Thanked 1,153 Times in 1,062 Posts
    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]
    Rui
    -------
    R4

Posting Permissions

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