bllgnn
Programmer
- Jan 20, 2002
- 42
I'm having trouble trying to create a recordset from a query with 2 parameters, one of which might be null.
I learned recently on this great forum that running a query from a *form* to use the following on the Criteria row of the query if one of the parameters might be null.
Like "*" & [Forms]![frmEngines]![txtEngine]
Can someone tell me how to do this in DAO?
Here's a snippit of my code that doesn't work.
Set qdParts = MyDb.QueryDefs("qryPartsSold"
'set the parameters of the query
qdParts.Parameters("Please enter EngineID" = rsSalesTx!EngineID
qdParts.Parameters("Please enter ComponentID" = rsSalesTx!ComponentID
'open a recordset based on the QueryDef object
Set rsParts = qdParts.OpenRecordset
I learned recently on this great forum that running a query from a *form* to use the following on the Criteria row of the query if one of the parameters might be null.
Like "*" & [Forms]![frmEngines]![txtEngine]
Can someone tell me how to do this in DAO?
Here's a snippit of my code that doesn't work.
Set qdParts = MyDb.QueryDefs("qryPartsSold"
'set the parameters of the query
qdParts.Parameters("Please enter EngineID" = rsSalesTx!EngineID
qdParts.Parameters("Please enter ComponentID" = rsSalesTx!ComponentID
'open a recordset based on the QueryDef object
Set rsParts = qdParts.OpenRecordset