I'm trying to open a form and use a recordset from a stored procedure
using these instructions:
http://www.mvps.org/access/queries/qry0003.htm
Using MS Access 2002 Project as frontend to sql server.
The user has a form with a dropdown box and an Ok button with the below
code. I get an error regarding the Set qdfParmQry line:
"Object variable or With block variable not set"
Private Sub Ok_Click()
Dim db As Database 'current database
Dim rs As Recordset 'holds query resultset
Dim qdfParmQry As QueryDef 'the actual query object
Set db = CurrentDb()
' sp_NotDropped is the name of the query
Set qdfParmQry = db.QueryDefs("sp_NotDropped")
' DADMISParam is the name of the parameter in the query design
qdfParmQry("DADMISParam") = Me![Combo2]
Set rs = qdfParmQry.OpenRecordset()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PITWorkSheet"
DoCmd.OpenForm stDocName, acFormDS
Forms![PITWorkSheet].Recordset = rs
Forms![PITWorkSheet].Caption = Me![Combo2].Column(1)
DoCmd.Close acForm, Me.Name, acSaveNo
Exit_Ok_Click:
Exit Sub
Err_Ok_Click:
MsgBox Err.Description
Resume Exit_Ok_Click
End Sub
Many thanks for any help. Today has been frustratin.