troubleshooting Question

Format dates in code

Avatar of c9k9h
c9k9h asked on
DatabasesMicrosoft Access
9 Comments1 Solution597 ViewsLast Modified:
I was a little too quick to close my last question.  I have capricorn's code:
strSQL = "SELECT * FROM MIR.ReportData WHERE ReportingDate BETWEEN date() and DateSerial(Year(Date()), (Month(Date()) - 13), 1)
But I'm getting an 'ODBC call failed' error.  I think it's around the formatting of the date.  This is pulling from Teradata and the format has to be yyyy/mm/dd.  I tried this, but am still getting the error.
strSQL = "SELECT * FROM MIR.ReportData WHERE ReportingDate BETWEEN Format(Date(), 'yyyy/mm/dd')and Format(DateSerial(Year(Date()), (Month(Date()) - 13), 1), 'yyyy/mm/dd')"
 Any ideas?  Thanks!

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 9 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 9 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