Type mismatch error (run time error 13)

Rawr

Registered User.
Local time
Today, 07:46
Joined
Jun 27, 2011
Messages
14
Hello,

I get the following error when I try to open my report:

Run-time error '13';
Type mismatch

Here is my code:


tmpdate = DateAdd("d", 1, Me.allTicketEnd)
DoCmd.OpenReport "Tickets Details", acViewReport, , "[Opened Date] Between #" & Me.allTicketStart & "#
And #" & tmpdate & "#" And "[Referred to] = '" & Me.curEmployee & "'"

Info:
[Opened Date] is a date field, as are allTicketStart and tmpdate.
[Referred to] is a text field, as is curEmployee

I know for a fact the bolded code works.

Thank you for your time.
 
it could just be a simple case of logic. Enclose the date part of the criteria in brackets so that is evaluated seperately to the employee referedto
"(([Opened Date] Between #" & Me.allTicketStart & "# And #" & tmpdate & "#) And ([Referred to] = '" & Me.curEmployee & "'))"
However the code you have posted is faulty so if that is copy and paste that would be the problem. You have 2 erronious speech marks " "

"[Opened Date] Between #" & Me.allTicketStart & "# And #" & tmpdate & "#" And "[Referred to] = '" & Me.curEmployee & "'"
 
Thanks Isskint, it was the quotes that were causing the problem.
 

Users who are viewing this thread

Back
Top Bottom