Avatar of Sandra Smith
Sandra Smith
Flag for United States of America asked on

EXCEL VBA SQL statement to ACCESS 2003 not working

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
Microsoft DevelopmentMicrosoft ApplicationsMicrosoft Excel

Avatar of undefined
Last Comment
Sandra Smith

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Norie

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Sandra Smith

ASKER
Yes, the percentage worked.

Sandra
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck