错误在使用QueryDefs返回记录集 [英] Error when using QueryDefs to return Recordset
本文介绍了错误在使用QueryDefs返回记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图访问使用VBA code进行查询。我想我已经做了这样的100倍。我的code(上一个命令按钮),开始是这样的:
I'm trying to access a query using VBA code. I think I've done it this way 100 times. My code (on a command button) starts like this:
Dim rstDocCount As Recordset
Set rstDocCount = CurrentDb.QueryDefs("DocCount").OpenRecordset
rst.MoveFirst
我收到此错误信息:
I get this error message:
运行时错误'3061':参数太少。预期1。
Run-time error '3061': Too few parameters. Expected 1.
在设置rstDocCount
行以黄色高亮显示。
我是什么做错了吗?唯一的参数应该是查询的名称和予清楚有
What am I doing wrong? The only parameter should be the name of the query and I clearly have that.
推荐答案
您需要:
Dim rstDocCount As Recordset
Dim qdf As QueryDef
Set qdf = CurrentDb.QueryDefs("DocCount")
qdf.Parameters("Forms!Boxing!BoxID") = Forms!Boxing!BoxID
Set rstDocCount = qdf.OpenRecordset
rstDocCount.MoveFirst
这篇关于错误在使用QueryDefs返回记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文