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. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Administrator
    Join Date
    Jun 2010
    Location
    Portugal
    Posts
    10,308
    Thanks
    130
    Thanked 1,159 Times in 1,067 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
  •