Not really sure how to call an Access query and pass parameters in ADO. My query works, my VBA code does not.
Here's my code any help would be greatly appreciated!
Dim db As Database
Dim rst As Recordset
Dim qdf As QueryDef
Set db = CurrentDb
Set qdf = db.QueryDefs("qry_GetWorksheetFlag")
'GetWorksheetID() is function that gets the current ID
qdf.Parameters(0).Value = GetWorksheetID()
'Set rst = qdf.OpenRecordset error I get here is "Type mismatch"
' not sure which to use neither works
Set rst = CurrentDb.OpenRecordset(QDef, dbOpenDynaset)
Error I get "The Microsoft Jet database engine cannot find the input table or query ''. Make sure it exists and that its name is spelled correctly."
Thanks
CJ
Here's my code any help would be greatly appreciated!
Dim db As Database
Dim rst As Recordset
Dim qdf As QueryDef
Set db = CurrentDb
Set qdf = db.QueryDefs("qry_GetWorksheetFlag")
'GetWorksheetID() is function that gets the current ID
qdf.Parameters(0).Value = GetWorksheetID()
'Set rst = qdf.OpenRecordset error I get here is "Type mismatch"
' not sure which to use neither works
Set rst = CurrentDb.OpenRecordset(QDef, dbOpenDynaset)
Error I get "The Microsoft Jet database engine cannot find the input table or query ''. Make sure it exists and that its name is spelled correctly."
Thanks
CJ