• Form Reference for Criteria in a Crosstab (2003 SP1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Form Reference for Criteria in a Crosstab (2003 SP1)

    Author
    Topic
    #422093

    Huge screenshot reduced in size by HansV since it caused horizontal scrolling. PLEASE don’t post images larger than 640×480.

    I’m stumped. I have a crosstab query where one of the criteria is a reference to a combo box on an open form. When I run the query I get this error.

    “The Microsoft Jet database engine does not recognize ‘forms![hrly Trng Report for Supervisor]!ComboCrew’ as a valid field name or expression.”

    A picture of the query and form behind it is attached.

    What’s causing that error? If I enter the value into the crosstab, the query runs without errors. I’m sure you can reference a form control in a crosstab. I’ve done it in the Northwind db.

    Sarah

    Viewing 1 reply thread
    Author
    Replies
    • #961350

      You must declare the parameter explicitly:

      Open the query in design view.
      Select Query | Parameters…
      Enter the parameter exactly as it’s used in the Criteria line, and select the appropriate data type. Then click OK.

      • #961351

        Oh you are so smart.

        That worked. Forgot about that. I take it that’s necessary with crosstabs. I know it isn’t for regular select queries.

        Thanks for the help.

    • #961355

      See ACC2000: Error When Running Crosstab Query with a Parameter for an explanation why it is necessary for crosstab queries.

    Viewing 1 reply thread
    Reply To: Form Reference for Criteria in a Crosstab (2003 SP1)

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

    Your information: