Below is piece of code that has been working fine and now its suddenly started giving errors (type mismatch error 13) when it gets to the evaluate parameters line (marked *).
The query has one parameter which is a date field with "Between [forms]!.. And [forms]!..." criteria. The form it's getting these dates from has two unbound text boxes called startdate and lastdate both formatted as Short Date.
<snip>
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdfelist As DAO.QueryDef
Dim prm As Parameter
Dim objOutlook As Outlook.Application
Set db = CurrentDb
Set objOutlook = CreateObject("Outlook.Application"
Set qdfelist = db.QueryDefs("eqryNewReadingsMail"
' Evaluate query start date and end date parameters
* For Each prm In qdfelist.Parameters
prm.Value = Eval(prm.Name)
Next prm
Set rst = qdfelist.OpenRecordset(dbOpenDynaset)
</snip>
Anyone have any ideas why this is happening? Oh... and I have recently imported all of the objects into a fresh database. I have included the DAO 3.6 and Office references.
The query has one parameter which is a date field with "Between [forms]!.. And [forms]!..." criteria. The form it's getting these dates from has two unbound text boxes called startdate and lastdate both formatted as Short Date.
<snip>
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdfelist As DAO.QueryDef
Dim prm As Parameter
Dim objOutlook As Outlook.Application
Set db = CurrentDb
Set objOutlook = CreateObject("Outlook.Application"

Set qdfelist = db.QueryDefs("eqryNewReadingsMail"

' Evaluate query start date and end date parameters
* For Each prm In qdfelist.Parameters
prm.Value = Eval(prm.Name)
Next prm
Set rst = qdfelist.OpenRecordset(dbOpenDynaset)
</snip>
Anyone have any ideas why this is happening? Oh... and I have recently imported all of the objects into a fresh database. I have included the DAO 3.6 and Office references.