I need assistance to run SQL subqueries. This is a complex job to describe, but I am happy to to email to anybody a copy of the tables with an outline of the problem. This is roughly what I am attempting:
strSQLsub = "SELECT [EmployeeID] FROM [tblEmployees]"
strSQL = "SELECT tblTSHeader.EmployeeID, tblTSHeader.Date, [tblDate].Date, [tblDate].Description, [tblEmployees].EmploymentDate, Weekday([tblDate].Date) AS [Day]"
strSQL = strSQL & "FROM tblDate LEFT JOIN _One ON [tblDate].Date = [_One].Date "
strSQL = strSQL & "WHERE ((([tblDate].Date) < Now()) And (([_One].Date) Is Null) And (([tblDate].Description) Is Null) And ((Weekday([tblDate].Date)) <> 1 And (Weekday([tblDate].Date)) <> 7)) "
My problem comes with the portion where I wish to add something like a DLookup in the middle of the statment to say : "Select the above where the date of employment of this particular employee"
Any suggestions will be most welcome.
Kind regards
Werner
strSQLsub = "SELECT [EmployeeID] FROM [tblEmployees]"
strSQL = "SELECT tblTSHeader.EmployeeID, tblTSHeader.Date, [tblDate].Date, [tblDate].Description, [tblEmployees].EmploymentDate, Weekday([tblDate].Date) AS [Day]"
strSQL = strSQL & "FROM tblDate LEFT JOIN _One ON [tblDate].Date = [_One].Date "
strSQL = strSQL & "WHERE ((([tblDate].Date) < Now()) And (([_One].Date) Is Null) And (([tblDate].Description) Is Null) And ((Weekday([tblDate].Date)) <> 1 And (Weekday([tblDate].Date)) <> 7)) "
My problem comes with the portion where I wish to add something like a DLookup in the middle of the statment to say : "Select the above where the date of employment of this particular employee"
Any suggestions will be most welcome.
Kind regards
Werner