Hi all
I'm converting a db from Acc97 to 2000. Everything works, except assigning
of a qdf object containing parameters, to a recordset.
The db, recordset, and qrydef objects are all referenced as DAO objects, and
the reference to dao 3.6 is present and working.
The code breaks at the last statement (below) with an 'invalid arguament'
error 3001.
Note that the parameters are both dates.
Also note that this works perfectly well in ACC97 format.
Also that it compiled without any indication of errors, or lost references.
me.start and me.end are taken from controls on an imput form. They are
formatted as short dates.
Thanks
Gerry Abbott
Code extract
-------------------------------------------------------------------
Dim qdfAdj As DAO.QueryDef
Dim rsAdj As DAO.Recordset
Dim mySql As String
Dim db As DAO.Database
Set db = CurrentDb
Set qdfAdj = db.QueryDefs("qryAccountsAdjSummary")
qdfAdj.Parameters("parameter1") = Me.Start
qdfAdj.Parameters("parameter2") = Me.End
Set rsAdj = qdfAdj.OpenRecordset
"qryAccountsAdjSummary"
SELECT tblStockItems.ProdId, tblMovements.mQuantity
FROM tblStockItems INNER JOIN tblMovements ON tblStockItems.stockId =
tblMovements.stockId
WHERE (((tblMovements.LocId)=sysconst(3)) AND ((tblMovements.sDate) Between
[parameter1] And [parameter2]))
ORDER BY tblStockItems.ProdId;
---------------------------------------------------------------------