troubleshooting Question

Problem with Date Comparison inside Query

Avatar of buybuy
buybuy asked on
Web Servers
4 Comments1 Solution200 ViewsLast Modified:
Hi, Experts, please help. I have tried this for the whole day but could not figure it out. I have 'EventFromDate' and 'EventToDate' in my MS Acess. Now I would like to list events fall in between these dates using "today's" date as comparison.

Here is my query and please let me know where the problem is

<cfset newdate=#dateformat(now())#>
<CFQUERY NAME="ListEvent" DATASOURCE="Eventdb" dbtype="ODBC">
     SELECT * FROM Event
     WHERE EventFromDate <= '#newdate#' AND EventToDate >= '#newdate#'
</CFQUERY>

I keep getting

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

no matter how I do. Is there anything to do with my "Data Type" in Access?

Thanks.
ASKER CERTIFIED SOLUTION
CFXPERT

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros