Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DAO QueryDef parameter errors

Status
Not open for further replies.

hpicken

Technical User
Joined
Apr 12, 2001
Messages
142
Location
AU
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(&quot;Outlook.Application&quot;)
Set qdfelist = db.QueryDefs(&quot;eqryNewReadingsMail&quot;)

' 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.


 
As an add-on, The query runs fine on it's own.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top