troubleshooting Question

EXCEL VBA SQL statement to ACCESS 2003 not working

Avatar of Sandra Smith
Sandra SmithFlag for United States of America asked on
Microsoft ExcelMicrosoft ApplicationsMicrosoft Development
2 Comments1 Solution375 ViewsLast Modified:
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?

Sandra

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
ASKER CERTIFIED SOLUTION
NorieAnalyst Assistant
Join our community to see this answer!
Unlock 1 Answer and 2 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 2 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