The following Statement runs perfectly normal:
.CommandText = Array("SELECT event.date, event.time, event.endtime, event.duration," _
& " event.ccode, event.""desc"", event.staff, event.client, event.eve1_03_01" _
& " FROM TimeMatters9.tm9user.event event" _
& " WHERE (event.date >= '" & startdate & "')" _
& " And (event.date <= '" & enddate & "')")
When I add the following red text I get a Mismatch error:
.
CommandText = Array("SELECT event.date, event.time, event.endtime, event.duration," _
& " event.ccode, event.""desc"", event.staff, event.client, event.eve1_03_01" _
& " FROM TimeMatters9.tm9user.event event" _
& " WHERE (event.date >= '" & startdate & "')" _
& " And (event.date <= '" & enddate & "')" _
& " And (event.date Like '-%'")
I want to run the first query with a criteria where CCODE begins with a '-'. So I added the like statement and before VBA attempts the query I get the mismatch error.
If I were to put it
it runs fine, so datatype is not a problem. It is a string. For some reason it does not like the 'Like' operator, no matter how I use it.
I've also tried using a Left function to get the first character. Works fine in the SELECT Clause but not when added to the WHERE.
Any ideas? Anyone experienced this?
Bookmarks