Results 1 to 2 of 2
  1. #1
    Buakaw is offline Absolute novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    112

    SQL Parameters keyword?

    Hi,


    I'm trying to modify a sample database and came across this query:

    Code:
    PARAMETERS [[Forms]!fmnuReportSelect![cboSrvID]] Long;
    TRANSFORM Count(tblResponses.Rspns) AS CountOfRspns
    SELECT tblQuestions.QstnID, tblQuestions.QstnLvl1, tblQuestions.QstnLvl2, tblQuestions.QstnLvl3, tblQuestions.QstnText, tblResponses.Rspns, tblQuestions.SrvID
    FROM tblQuestions INNER JOIN tblResponses ON tblQuestions.QstnID = tblResponses.QstnID
    WHERE (((tblQuestions.SrvID)=[Forms]![fmnuReportSelect]![cboSrvID]) AND ((tblQuestions.QstnType)="Stat" Or (tblQuestions.QstnType)="Demo"))
    GROUP BY tblQuestions.QstnID, tblQuestions.QstnLvl1, tblQuestions.QstnLvl2, tblQuestions.QstnLvl3, tblQuestions.QstnText, tblResponses.Rspns, tblQuestions.SrvID
    PIVOT "Number of Responses" In ("Number of Responses");
    However a syntax error is flagged by Access if I try to make any changes. It says:
    "Syntax error in PARAMETER clause".

    Does anyone know what's wrong with it? I suspect it's the name of the variable itself.

    Thanks!

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    I suspect that PARAMETERS can't take form references. You need to put the name of the param in that place. that's the point of a parameter. If you want a pointer to a form's value somewhere, put it in the WHERE clause. that's where it belongs.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Incorrect syntax near keyword “ORDER"
    By k9drh in forum Import/Export Data
    Replies: 1
    Last Post: 06-13-2011, 07:36 AM
  2. Replies: 7
    Last Post: 04-29-2011, 03:44 PM
  3. Making a keyword search
    By timmy in forum Forms
    Replies: 9
    Last Post: 03-14-2011, 02:57 AM
  4. Too few parameters
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 12-23-2010, 10:28 AM
  5. Extracting data after a keyword
    By KerryA in forum Queries
    Replies: 1
    Last Post: 02-11-2010, 09:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums