Convert String Date to Date for a SQL Query
Hi all,
Im having a problem with a SQL Query. Im try to do a search of invoices between a date range specified by the the user.
They fill out 3 form fields DayFrom, MonthFrom and YearFrom and the same for DayTo, MonthTo and YearTo.
I then join these values. eg.
BeforeDate = DayFrom & "/" & MonthFrom & "/" & YearFrom
and
ToDate = DayTo & "/" & MonthTo & "/" & YearTo
When i query the db i get error
Data type mismatch in criteria expression
How can i convert the string to compare to a Date field in my DB.
My SQL is like this for a starter.
strSQL = "SELECT * FROM tblJobs WHERE JobPerson LIKE '%"&SearchCriteria&"%' AND JobDate = '"&BeforeDate&"'"
Thanks in advance
TDA
__________________
TDA
|