Microsoft KB Archive/91710
Article ID: 91710
Article Last Modified on 1/18/2007
- Microsoft Access 1.0 Standard Edition
- Microsoft Access 1.1 Standard Edition
- Microsoft Access 2.0 Standard Edition
- Microsoft Access 95 Standard Edition
- Microsoft Access 97 Standard Edition
This article was previously published under Q91710
Moderate: Requires basic macro, coding, and interoperability skills.
If you create a crosstab query that uses an implicit parameter [XXX] in a WHERE clause (criteria), you may receive the following error message in Microsoft Access 97:
In earlier versions of Microsoft Access, you receive the following error message:
If you use an explicit parameter, the query works as expected.
A crosstab query dynamically generates column names. Therefore, Microsoft Access cannot tell whether [XXX] refers to a parameter or to 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 typical crosstab query.
Define an Explicit Parameter:
To avoid this error, define [XXX] as an explicit parameter by adding it to the Query Parameters dialog box.
Use Code to Change the Column Headings:
You can use Microsoft Visual Basic for Applications to dynamically change the column headings in the crosstab query.
For additional information about how to use code to change column headings, click the article number below to view the article in the Microsoft Knowledge Base:
155489 ACC: How to Use Code to Change Column Headings in Crosstab Query
This behavior is by design.
Steps to Reproduce the Behavior
- Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0 or earlier).
- Create a new crosstab query that is based on the Order Details table.
Drag the UnitPrice, the Discount, and the OrderID fields to the QBE grid and then set the values in the grid as follows:
NOTE: Type a space in the Unit Price and the Order ID fields in version 1.0, 1.1, 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
- Run the query. Note that you receive the error message that is mentioned in the "Symptoms" section.
- Click OK to return to Query Design view and then click Parameters on the Query menu.
- Enter the following under Parameters:
[Enter an Amount:]
- Select Currency as the data type, and then click OK.
- Run the query and type any amount (for example, type 2). Notice that the query runs.
For additional information about crosstab queries, click the article numbers below to view the articles in the Microsoft Knowledge Base:
104758 ACC: Error with Linked Crosstab Subform or Subreport
109939 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.
Additional query words: can t bind name [XXX] prb
Keywords: kberrmsg kbprb KB91710