ACC: "Can't Bind Name '[XXX]'" Error with Crosstab Query

Last reviewed: May 28, 1997
Article ID: Q91710
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

If you create a crosstab query using an implicit parameter [XXX] in a WHERE clause (criteria), you may receive the following error message:

   In Microsoft Access 97:

      The Microsoft Jet database engine does not recognize '[XXX]' as a
      valid field name or expression.

   In earlier versions of Microsoft Access:

      Can't bind name '[XXX]'

If you use an explicit parameter, the query works as expected.

CAUSE

A crosstab query dynamically generates column names. Therefore, Microsoft Access cannot tell whether [XXX] is referring to a parameter or a column name until after the query is bound.

When you build a graph, Microsoft Access uses a crosstab to build the data to graph. If the query is a parameter query, you have to define the parameters explicitly, as you would have to for a normal crosstab query.

RESOLUTION

To avoid this error, define [XXX] as an explicit parameter by adding it to the Query Parameters dialog box.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0 or earlier).

  2. Create a new crosstab query based on the Order Details table.

  3. Drag the UnitPrice, Discount, and OrderID fields to the QBE grid, and set the values in the grid as follows.

    NOTE: Type a space in the Unit Price and Order ID fields in version 1.x and 2.0.

          Crosstab Query: Query1
          ---------------------------------
          Field: UnitPrice
    
             Total: Group By
             Crosstab: Row Heading
             Criteria: > [Enter an Amount:]
          Field: Discount
             Total: Group By
             Crosstab: Column Heading
          Field: OrderID
             Total: Count
             Crosstab: Value
    
    

  4. Run the query. Note that you receive the error message mentioned in the "Symptoms" section.

  5. Click OK to return to Query Design view, and then click Parameters on the Query menu.

  6. Enter the following under Parameters:

          [Enter an Amount:]
    

  7. Select Currency as the data type, and then click OK.

  8. Run the query and type any amount (for example, type "2"). Note that the query runs.

REFERENCES

For more information about crosstab queries, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q104758
   TITLE     : ACC: Error with Linked Crosstab Subform or Subreport

   ARTICLE-ID: Q109939
   TITLE     : ACC: Creating a Crosstab Query with Multiple Value Fields

For more information about parameter queries, type "parameter queries" in the Office Assistant, click Search, and then click to view "Troubleshoot parameter queries."


Keywords : kberrmsg kbusage QryCross
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : x86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.