9/1/2005
I am having difficulty opening a query recordset for analysis.
The following code opens the query with no problems when the query has
either no criteria or criteria specified as constants. When I attempt to put
a variable in the query criteria, it stops at the line
.Open qryName, Options:=adCmdTableDirect
with the Run Time Error that says "Too few parameters. Expected x" where x
is the number of variables specified in the criteria
Can you tell me what is wrong and how to fix it?
I will post this to a couple of newsgroups because I'm not sure which one is
appropriate.
If possible, please respond to me directly at
[email protected]. as I am
a newbie to these newsgroups.
Many many thanks.
Al Baker
Sub QueryTableLookup()
Const qryName As String = "qryVerifyDeleteRecords"
Dim rstqryEquipOne As ADODB.Recordset
Set rstqryEquipOne = New ADODB.Recordset
Set rstqryEquipOne.ActiveConnection = CurrentProject.Connection
With rstqryEquipOne
.CursorType = adOpenKeyset
.Open qryName, Options:=adCmdTableDirect
End With
DoCmd.OpenQuery qryName, acNormal, acEdit
rstqryEquipOne.MoveFirst
LastEquipId = rstqryEquipOne!ID
Stop
End