ACC2000: Query with Expression on Expression Prompts for Parameter (208968)
The information in this article applies to:
This article was previously published under Q208968 This article applies only to a Microsoft Access database (.mdb).
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you run a query, Microsoft Access prompts you to enter a parameter
value even though you have not defined a parameter in the query.
CAUSE
You have an expression in your query that has a criteria or sort order, and the query references a different field in the query that uses an alias.
This can be seen most easily in the query's SQL view. The SELECT list can
include expression names, but other clauses, such as WHERE and ORDER BY,
cannot.
RESOLUTION
There are two ways to work around this behavior:
- Substitute the first expression for the first expression's name in the second expression.
- Create a second query based on the initial query and include the sort order and criteria in the second query.
Please see the "Steps to Reproduce Behavior" section of this article for
examples of these two methods.
STATUS
Microsoft Access supports referencing column aliases only in the field list (SELECT clause) of a query, not in the ORDER BY or the WHERE clause.
REFERENCESFor more information about calculated fields in queries, click Microsoft Access Help on the
Help menu, type perform calculations in a query in the Office Assistant or
the Answer Wizard, and then click Search to view the topics
returned.
Modification Type: | Major | Last Reviewed: | 6/30/2004 |
---|
Keywords: | kbprb KB208968 |
---|
|