In MS Access 2007 I occasionally come across this issue: A query will start to produce a "Enter Parameter Value" prompt -- only the prompt is for a field that I do not reference in my SQL.
qryOPI_ReportingLocation
):SELECT CODES.ReportingLocation, DateValue(OPI.EncDateTime) AS ApptDate, OPI.MedRec, OPI.AccessCode
FROM [OPI DATA] AS OPI LEFT JOIN [Access Codes] AS CODES ON OPI.AccessCode=CODES.Code
WHERE (IsNumeric(MedRec)) And (OPI.EncDateTime>=#10/1/2013#) AND (OPI.EncDateTime<#10/1/2014#);
Why am I being asked for this parameter? If I hit Cancel
, the query fails to run. If I enter any value (for example: bob
) the query will run correctly.
What's really frustrating, is if I take that same SQL, paste it into a newly created query it runs without a hitch. I then delete the old query and rename the new one until next time.
Is there a better way?
答案 0 :(得分:1)
通常,在我遇到此问题的任何时候,查询中都会留下剩余的Order By
字段。之前设置的东西和SQL已被更改,但它仍然存在。
将查询放入SQL视图,然后在Property Sheet
的右侧删除Order By
属性中的任何内容,错误就会消失。
第二个可能只是一个拼写错误的字段名称,但是因为它看起来像是使用Query Design
创建的,所以不太可能。
答案 1 :(得分:0)
这通常是由拼写错误的字段名称引起的。如果您拼写的字段名称与查询或表格定义中拼写的字段名称略有不同,则Access会将其视为参数。