I want to pass a parameter in a saved query in MS Access 2010 and then want to get results from the query : Its my saved query:
SELECT Count (*) to tb_KonzeptDaten WHERE (Konzept = [fzg_ID] and (DCMFile is zero or (DCMFile = ''))); And to ask this question is my VBA code:
DAO as a slow DB. Database Dish Curie DAO As qQueryDef set qry = db.QueryDefs ("Test_qr_emptyDCM") qry.Parameters ("fzg_ID"). Value = id set RS = qry.OpenRecordset ("Test_qr_emptyDCM") Also the type of ID in the VBA code is the long and the area of the Conjunction is Long Integer Why do I get this error and how do I solve it?
Your problem is with the qry.OpenRecordset statement. The first parameter for QueryDef.OpenRecordset is [Type] (e.g., dbOpenSnapshot ). You do not need to provide a query name because you have already supplied it when you create a QueryDef object. Just try to use
Set RS = qry.OpenRecordset
No comments:
Post a Comment