I have a subform, whose data source is a parametered stored procedure.
The following code is added in Form_open, but I always got the error msg 'the object you entered is not a valid recordset property'. I've read the disconnection problem that posted on MS website, however it seems not for my case. I tried cursor too, not work.
Any suggestions are very much appreciated~~
The following code is added in Form_open, but I always got the error msg 'the object you entered is not a valid recordset property'. I've read the disconnection problem that posted on MS website, however it seems not for my case. I tried cursor too, not work.
Any suggestions are very much appreciated~~
Code:
Private Sub WhoFinishedSubFormRequery()
Dim sql As String
Dim cmd As ADODB.Command, rst As ADODB.Recordset
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = "EXEC dbo.spWhoFinishedBySurveyAndYear '" & Me.surveyName & "'," & Me.surveyYear
cmd.CommandType = adCmdText
Set rst = cmd.Execute
Set Me![frmTrackingWhoFinished].Form.Recordset = rst //where the error is
Set rst = Nothing
Set cmd = Nothing
End Sub
Comment