运行时错误“3061".参数太少.预期 1.(访问 2007) [英] Run-time error '3061'. Too few parameters. Expected 1. (Access 2007)
问题描述
我有以下 'set recordset'
行,我无法工作.根据我可以找到的有关该主题的所有可用帮助,这些参数似乎是正确的.
I have the following 'set recordset'
line that I cannot get working. The parameters seem correct according to all available help I can find on the subject.
错误显示:
运行时错误‘3061’.参数太少.应为 1."
"Run-time error '3061'. Too few parameters. Expected 1."
代码如下:
Set rs = dbs.OpenRecordset("SELECT Centre_X, Centre_Y FROM [qry_all_details]
WHERE ID = " & siteID & ";", dbOpenSnapshot)
Where rs is the recordset (Dim rs As Recordset) and dbs = CurrentDb()
任何帮助将不胜感激.
我尝试删除 WHERE
原因但没有任何效果,并且还在双引号之间使用单引号,但没有任何效果.
I have tried removing the WHERE
cause with no effect, and also using single quotes between double quotes, but no joy.
非常感谢.
推荐答案
"运行时错误 '3061'.参数太少.预期为 1."
"Run-time error '3061'. Too few parameters. Expected 1."
我相信当您的 sql 查询中的字段名称与表字段名称不匹配时会发生这种情况,即查询中的字段名称错误或表可能完全缺少该字段.
I believe this happens when the field name(s) in your sql query do not match the table field name(s), i.e. a field name in the query is wrong or perhaps the table is missing the field altogether.
这篇关于运行时错误“3061".参数太少.预期 1.(访问 2007)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!