C
Cameron
I have a couple of reports that work fine in a form and they pretty much all
gather information the same way. But one query fails every time and gives me
the error "Invalid Argument." I'm kind of baffled on why this might be.
The SQL for the report is as follows:
SELECT DISTINCTROW Team.Team, RADAR.RadarDate, RADAR.RadarId,
RADAR.SafeSolution, RADAR.Tasks,
DCount("[RadarEmployeeID]","RadarEmployee","[RadarEmployee]![RadarId] =" &
[radar]![RadarId]) AS EmpCnt,
DCount("[Hazard]","RadarHazard","[RadarHazard]![RadarId] = " &
[radar]![radarid]) AS HazCnt
FROM Team INNER JOIN ((RADAR INNER JOIN (Employee INNER JOIN RadarEmployee
ON Employee.EmployeeId = RadarEmployee.RadarEmployeeID) ON RADAR.RadarId =
RadarEmployee.RadarId) INNER JOIN (Hazards INNER JOIN RadarHazard ON
Hazards.hazardID = RadarHazard.Hazard) ON RADAR.RadarId =
RadarHazard.RadarId) ON Team.TeamID = Employee.Team
WHERE (((RADAR.RadarDate)>=[Forms]![ReportsMainForm]![ReportingStartDate]
And (RADAR.RadarDate)<=[Forms]![ReportsMainForm]![ReportingEndDate]) AND
((RADAR.Tasks) Like "*" & [Forms]![ReportsMainForm]![TextSearchString] & "*")
AND ((RadarEmployee.RadarEmployeeID) Like
nz([Forms]![ReportsMainForm]![EmployeeSelection],"*")) AND
((RadarHazard.Hazard) Like
nz([Forms]![ReportsMainForm]![HazardSelection],"*")) AND
((Employee.InActive)=No) AND ((Employee.Team) Like
nz([Forms]![ReportsMainForm]![TeamSelection],"*"))) OR
(((RADAR.RadarDate)>=[Forms]![ReportsMainForm]![ReportingStartDate] And
(RADAR.RadarDate)<=[Forms]![ReportsMainForm]![ReportingEndDate]) AND
((RADAR.SafeSolution) Like "*" & [Forms]![ReportsMainForm]![TextSearchString]
& "*") AND ((RadarEmployee.RadarEmployeeID) Like
nz([Forms]![ReportsMainForm]![EmployeeSelection],"*")) AND
((RadarHazard.Hazard) Like
nz([Forms]![ReportsMainForm]![HazardSelection],"*")) AND
((Employee.InActive)=No) AND ((Employee.Team) Like
nz([Forms]![ReportsMainForm]![TeamSelection],"*")))
ORDER BY Team.Team, RADAR.RadarDate;
If you need more info let me know, and I can past that here too.
Cam
gather information the same way. But one query fails every time and gives me
the error "Invalid Argument." I'm kind of baffled on why this might be.
The SQL for the report is as follows:
SELECT DISTINCTROW Team.Team, RADAR.RadarDate, RADAR.RadarId,
RADAR.SafeSolution, RADAR.Tasks,
DCount("[RadarEmployeeID]","RadarEmployee","[RadarEmployee]![RadarId] =" &
[radar]![RadarId]) AS EmpCnt,
DCount("[Hazard]","RadarHazard","[RadarHazard]![RadarId] = " &
[radar]![radarid]) AS HazCnt
FROM Team INNER JOIN ((RADAR INNER JOIN (Employee INNER JOIN RadarEmployee
ON Employee.EmployeeId = RadarEmployee.RadarEmployeeID) ON RADAR.RadarId =
RadarEmployee.RadarId) INNER JOIN (Hazards INNER JOIN RadarHazard ON
Hazards.hazardID = RadarHazard.Hazard) ON RADAR.RadarId =
RadarHazard.RadarId) ON Team.TeamID = Employee.Team
WHERE (((RADAR.RadarDate)>=[Forms]![ReportsMainForm]![ReportingStartDate]
And (RADAR.RadarDate)<=[Forms]![ReportsMainForm]![ReportingEndDate]) AND
((RADAR.Tasks) Like "*" & [Forms]![ReportsMainForm]![TextSearchString] & "*")
AND ((RadarEmployee.RadarEmployeeID) Like
nz([Forms]![ReportsMainForm]![EmployeeSelection],"*")) AND
((RadarHazard.Hazard) Like
nz([Forms]![ReportsMainForm]![HazardSelection],"*")) AND
((Employee.InActive)=No) AND ((Employee.Team) Like
nz([Forms]![ReportsMainForm]![TeamSelection],"*"))) OR
(((RADAR.RadarDate)>=[Forms]![ReportsMainForm]![ReportingStartDate] And
(RADAR.RadarDate)<=[Forms]![ReportsMainForm]![ReportingEndDate]) AND
((RADAR.SafeSolution) Like "*" & [Forms]![ReportsMainForm]![TextSearchString]
& "*") AND ((RadarEmployee.RadarEmployeeID) Like
nz([Forms]![ReportsMainForm]![EmployeeSelection],"*")) AND
((RadarHazard.Hazard) Like
nz([Forms]![ReportsMainForm]![HazardSelection],"*")) AND
((Employee.InActive)=No) AND ((Employee.Team) Like
nz([Forms]![ReportsMainForm]![TeamSelection],"*")))
ORDER BY Team.Team, RADAR.RadarDate;
If you need more info let me know, and I can past that here too.
Cam