I have the below statement that does work in the ACCESS 2003 database. However, it does not run. If I take out the WHERE clause of TblCompletedTask.TaskiD LIKE '*CON*', it will run. So, how can I get the EXCEl VBA code to recognize the like statement? Or will it even do that?
sSQL = "SELECT TblCompletedTask.TaskDate, tblUsers.DeptID, TblDepartment.DeptName, [LastName] & ', ' & [FirstName] AS FullName, " & _
"TblTaskCategory.CatName AS TaskCategory, tblTasks.Description AS Task, [TaskTimeTotal]/[Tasktime] AS TaskCount " & _
"FROM ((tblUsers INNER JOIN ((TblCompletedTask INNER JOIN tblTasks ON TblCompletedTask.TaskID = tblTasks.TaskID) " & _
"INNER JOIN TblTimeSheet ON TblCompletedTask.TSID = TblTimeSheet.TSID) ON tblUsers.UserID = TblTimeSheet.UserID) " & _
"INNER JOIN TblTaskCategory ON tblTasks.CatID = TblTaskCategory.CatID) INNER JOIN TblDepartment ON " & _
"tblTasks.DeptID = TblDepartment.DeptID " & _
"WHERE TblCompletedTask.TaskID Like '*CON*' AND tblUsers.DeptID = " & intDeptID