D
DS
I'm having a problem with this UNION query.
The sort order is saying that it can't sort on the [EmpFrstName] & "" ""
& [EmpLastName], it says that it isn't included. Also can I use Union
All as opposed to just UNION?
Thanks
DS
Me.RecordSource = "SELECT tblChecks.ChkBizDay, [EmpFirstName] & "" "" &
[EmpLastName] AS EMP, " & _
"tblChecks.ChkDate, tblChecks.ChkTime, tblChecks.CheckID, " & _
"tblChecks.ChkAlias, tblChecks.ChkCancelled, tblChecks.ChkKillID,
tblChecks.ChkTotal " & _
"FROM tblChecks LEFT JOIN tblEmployees ON tblChecks.ChkServer =
tblEmployees.EmployeeID " & _
"WHERE (((tblChecks.ChkBizDay) >= [Forms]![frmReportDates]![TxtStart] " & _
"And (tblChecks.ChkBizDay) <= [Forms]![frmReportDates]![TxtEnd]) " & _
"And ((tblChecks.ChkCancelled) = -1) And ((tblChecks.ChkKillID) = 0)) " & _
"UNION " & _
"SELECT tblChecks.ChkBizDay, [EmpFirstName] & "" "" & [EmpLastName] AS
EMP, " & _
"tblChecks.ChkDate, tblChecks.ChkTime, tblChecks.CheckID, " & _
"tblChecks.ChkAlias, tblChecks.ChkCancelled, tblChecks.ChkKillID,
tblChecks.ChkTotal " & _
"FROM tblChecks LEFT JOIN tblEmployees ON tblChecks.ChkServer =
tblEmployees.EmployeeID IN '//Backoffice/Warehouse/History.mdb' " & _
"WHERE (((tblChecks.ChkBizDay) >= [Forms]![frmReportDates]![TxtStart] " & _
"And (tblChecks.ChkBizDay) <= [Forms]![frmReportDates]![TxtEnd]) " & _
"And ((tblChecks.ChkCancelled) = -1) And ((tblChecks.ChkKillID) = 0)) " & _
"ORDER BY [EmpFirstName] & "" "" & [EmpLastName], tblChecks.ChkDate,
tblChecks.ChkTime;"
The sort order is saying that it can't sort on the [EmpFrstName] & "" ""
& [EmpLastName], it says that it isn't included. Also can I use Union
All as opposed to just UNION?
Thanks
DS
Me.RecordSource = "SELECT tblChecks.ChkBizDay, [EmpFirstName] & "" "" &
[EmpLastName] AS EMP, " & _
"tblChecks.ChkDate, tblChecks.ChkTime, tblChecks.CheckID, " & _
"tblChecks.ChkAlias, tblChecks.ChkCancelled, tblChecks.ChkKillID,
tblChecks.ChkTotal " & _
"FROM tblChecks LEFT JOIN tblEmployees ON tblChecks.ChkServer =
tblEmployees.EmployeeID " & _
"WHERE (((tblChecks.ChkBizDay) >= [Forms]![frmReportDates]![TxtStart] " & _
"And (tblChecks.ChkBizDay) <= [Forms]![frmReportDates]![TxtEnd]) " & _
"And ((tblChecks.ChkCancelled) = -1) And ((tblChecks.ChkKillID) = 0)) " & _
"UNION " & _
"SELECT tblChecks.ChkBizDay, [EmpFirstName] & "" "" & [EmpLastName] AS
EMP, " & _
"tblChecks.ChkDate, tblChecks.ChkTime, tblChecks.CheckID, " & _
"tblChecks.ChkAlias, tblChecks.ChkCancelled, tblChecks.ChkKillID,
tblChecks.ChkTotal " & _
"FROM tblChecks LEFT JOIN tblEmployees ON tblChecks.ChkServer =
tblEmployees.EmployeeID IN '//Backoffice/Warehouse/History.mdb' " & _
"WHERE (((tblChecks.ChkBizDay) >= [Forms]![frmReportDates]![TxtStart] " & _
"And (tblChecks.ChkBizDay) <= [Forms]![frmReportDates]![TxtEnd]) " & _
"And ((tblChecks.ChkCancelled) = -1) And ((tblChecks.ChkKillID) = 0)) " & _
"ORDER BY [EmpFirstName] & "" "" & [EmpLastName], tblChecks.ChkDate,
tblChecks.ChkTime;"