Hello again everyone
I have a problem with some VBA I’m trying to use, I’ve used the code before and it works fine, now it doesn’t so I’m obviously being thick….. Please let me know where I’ve missed the obvious.
Here’s the code: –
Dim strRecordCount As String
Dim dBs As DAO.Database
Dim Rst As DAO.Recordset
Dim qryDef As DAO.QueryDef
Set dBs = CurrentDb
Set qryDef = dBs.QueryDefs(“MonthsInPeriod1Qry”)
qryDef.Parameters = (“[Forms]![DateCtlFrm]![StartDateTxt]”) = Forms![DateCtlFrm]![StartDateTxt]
qryDef.Parameters = (“[Forms]![DateCtlFrm]![StopDateTxt]”) = Forms![DateCtlFrm]![StopDateTxt]
Set Rst = dBs.OpenRecordset(“MonthsInPeriod1Qry”)
strRecordCount = Rst.RecordCount
I get the error message “Invalid use of property” and the first .parameters is highlighted by the de######.
My query has exactly the same parameters in its parameters section, I’ve checked and rechecked the bit after the = to ensure it is pointing at the right data, no luck.
Please help..
Thanks
Ian