P
Penstar
I am using the following code to pass parameters into stored procedure to
select records. It all seems OK, but I can't seem to get the recordset
returned to the form. I have been trying to get it working for days, with no
success.
As the code is now, it gets to Set rs = cmd.Execute and says Runtime error
2147217900(80040e14) expected query name after execute.
Can someone please help.
Penny
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim prm1 As ADODB.Parameter
Set cn = CurrentProject.Connection
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = cn
.CommandText = testtimesheet
.CommandType = adCmdStoredProc
Set prm1 = .CreateParameter("prm1", adVarChar, adParamInput, 8000)
.Parameters.Append prm1
prm1.Value = "1"
End With
Set rs = cmd.Execute
Set Me.Recordset = rs
End Sub
select records. It all seems OK, but I can't seem to get the recordset
returned to the form. I have been trying to get it working for days, with no
success.
As the code is now, it gets to Set rs = cmd.Execute and says Runtime error
2147217900(80040e14) expected query name after execute.
Can someone please help.
Penny
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim prm1 As ADODB.Parameter
Set cn = CurrentProject.Connection
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = cn
.CommandText = testtimesheet
.CommandType = adCmdStoredProc
Set prm1 = .CreateParameter("prm1", adVarChar, adParamInput, 8000)
.Parameters.Append prm1
prm1.Value = "1"
End With
Set rs = cmd.Execute
Set Me.Recordset = rs
End Sub