TomDuCrosbie
Technical User
I have an application with an Access project front end and a Microsoft SQL server (both are 2000 versions) backend. The backend was recently converted to SQL using the upsizing wizard. I had this DAO code that worked prior to the upsize, now it doesn't work.
Dim qdef As QueryDef
Dim StrSQL As String
Dim StrParam As String
Dim db As DAO.Database
Set db = CurrentDb
Set qdef = db.QueryDefs("ReferralResultsMailReport"
StrParam = Forms!frmReferralResults!txtReferralID
StrSQL = "Exec ReferralResultsMailReport" & StrParam
qdef.SQL = StrSQL
I get the error "Runtime Error "91" Object Variable or with block variable not set. The error happens on the Set qdef line. In the Locals window the db adn qdef are both set to nothing. I believe this is where the problem is.
Does the variable db need to be set to the SQL backend? and if so how? I've only ever set db to CurrentDb and all the DAO programing is what I've learned from various snippits of web sites.
Thanks in advance for any help.
Tom
Dim qdef As QueryDef
Dim StrSQL As String
Dim StrParam As String
Dim db As DAO.Database
Set db = CurrentDb
Set qdef = db.QueryDefs("ReferralResultsMailReport"
StrParam = Forms!frmReferralResults!txtReferralID
StrSQL = "Exec ReferralResultsMailReport" & StrParam
qdef.SQL = StrSQL
I get the error "Runtime Error "91" Object Variable or with block variable not set. The error happens on the Set qdef line. In the Locals window the db adn qdef are both set to nothing. I believe this is where the problem is.
Does the variable db need to be set to the SQL backend? and if so how? I've only ever set db to CurrentDb and all the DAO programing is what I've learned from various snippits of web sites.
Thanks in advance for any help.
Tom