Anehab
05-02-2016, 04:53 AM
1607016069
16071
I keep getting this error. I try to add " to the end of my WHERE statement. I recently changed it from
strSQL = "SELECT Clients.Unit, COUNT(Events.Client_ID) as TimesTasked " _
& "FROM Clients LEFT JOIN Events ON Clients.Client_ID = Events.Client_ID " _
& "WHERE Events.Event_Start_DateTime <= #" & txtEndDate & "# AND Events.Event_End_DateTime >= #" & txtStartDate & "# AND Clients.Unit = """ & Unit & """ _
& " GROUP BY Clients.Unit;"
Once I run the code VB changes the three " after Unit to four """". So I changed it to the statement below.
strSQL = "SELECT Clients.Unit, COUNT(Events.Client_ID) as TimesTasked " _
& "FROM Clients LEFT JOIN Events ON Clients.Client_ID = Events.Client_ID " _
& "WHERE Events.Event_Start_DateTime <= #" & txtEndDate & "# AND Events.Event_End_DateTime >= #" & txtStartDate & "# AND Clients.Unit LIKE *" & Unit & "*" _
& " GROUP BY Clients.Unit;"
Honestly I wish I knew more about SQL but right now I am still learning and I really need the assistance. Im happy to provide any information that would be helpful to reaching a solution.
16071
I keep getting this error. I try to add " to the end of my WHERE statement. I recently changed it from
strSQL = "SELECT Clients.Unit, COUNT(Events.Client_ID) as TimesTasked " _
& "FROM Clients LEFT JOIN Events ON Clients.Client_ID = Events.Client_ID " _
& "WHERE Events.Event_Start_DateTime <= #" & txtEndDate & "# AND Events.Event_End_DateTime >= #" & txtStartDate & "# AND Clients.Unit = """ & Unit & """ _
& " GROUP BY Clients.Unit;"
Once I run the code VB changes the three " after Unit to four """". So I changed it to the statement below.
strSQL = "SELECT Clients.Unit, COUNT(Events.Client_ID) as TimesTasked " _
& "FROM Clients LEFT JOIN Events ON Clients.Client_ID = Events.Client_ID " _
& "WHERE Events.Event_Start_DateTime <= #" & txtEndDate & "# AND Events.Event_End_DateTime >= #" & txtStartDate & "# AND Clients.Unit LIKE *" & Unit & "*" _
& " GROUP BY Clients.Unit;"
Honestly I wish I knew more about SQL but right now I am still learning and I really need the assistance. Im happy to provide any information that would be helpful to reaching a solution.