Ok, well first off, I am very new to Excel/Access. Have used other scripts/DB's in the past ... granted a while ago. So please know that first when replying as I need responses in kindergarten form.
I think this would go here, but since it's really an SQL question it might need to go in Access. However, I'm getting an Excel error that I'm missing an operator. I've rewritten this about 6 times to make it more and more concise, but having problems with multi joins and multi where clauses.
I think my problems are in the WHERE clause.
I am trying to grab all rows from all tables where the EID matches, the person is active, and their schedule is a current one.
I think this would go here, but since it's really an SQL question it might need to go in Access. However, I'm getting an Excel error that I'm missing an operator. I've rewritten this about 6 times to make it more and more concise, but having problems with multi joins and multi where clauses.
I think my problems are in the WHERE clause.
I am trying to grab all rows from all tables where the EID matches, the person is active, and their schedule is a current one.
Code:
strSql = "SELECT * FROM ((([tblEmployee] " & _
" INNER JOIN [tblEmployment]" & _
" ON [tblEmployee].[EID] = [tblEmployment].[EID]) " & _
" INNER JOIN [tblHierarchy]" & _
" ON [tblEmployee].[EID] = [tblHierarchy].[EID]) " & _
" INNER JOIN [tblSchedules]" & _
" ON [tblEmployee].[EID] = [tblSchedules].[EID]) " & _
"WHERE (([tblEmployee].[EID]='" & EmpEID & "')" & _
" AND ([tblEmployment].[Active]='true')" & _
" AND ([tblSchedules].[ShiftStartDate]] < '" & Now() & "' < [tblSchedules].[ShiftEndDate]))"
[\code]
Thoughts?
Thanks,
James