Guest_imported
New member
- Jan 1, 1970
- 0
Hi-
I don't know why this code isn't working. I'm doing this in Access and all I'm trying to do is store the results of one of my queries as a Recordset.
Syntactically, I'm not convinced any of this is wrong, but I get a "Too few Parameters. Expected: 1" error on just the last line in this code block:
-------------------------------------------------------
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.Command
Set conn = CurrentProject.Connection
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
'In Help it says ADO treats queries as StoredProcedures
cmd.CommandType = adCmdStoredProc
'qryRunRateTotals is the name of the query I'm trying to put in the Recordset
cmd.CommandText = "qryRunRateTotals"
Set rst = New ADODB.Recordset
rst = cmd.Execute
-----------------------------------------------------------
Any advice? I've tried this using the Recordset.Open technique, but that's giving me errors, too.
Many thanks,
-Ed H.
I don't know why this code isn't working. I'm doing this in Access and all I'm trying to do is store the results of one of my queries as a Recordset.
Syntactically, I'm not convinced any of this is wrong, but I get a "Too few Parameters. Expected: 1" error on just the last line in this code block:
-------------------------------------------------------
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.Command
Set conn = CurrentProject.Connection
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
'In Help it says ADO treats queries as StoredProcedures
cmd.CommandType = adCmdStoredProc
'qryRunRateTotals is the name of the query I'm trying to put in the Recordset
cmd.CommandText = "qryRunRateTotals"
Set rst = New ADODB.Recordset
rst = cmd.Execute
-----------------------------------------------------------
Any advice? I've tried this using the Recordset.Open technique, but that's giving me errors, too.
Many thanks,
-Ed H.