DMax

B

Beal

I have a query, absenteeism by date, based on two sub queries, security employees and absenteeism. The security employees has all the names of the security associates and the absenteeism query contains their sick dates
The following is the SQL statement that I use
SELECT [Absenteeism Query].AbsenteeismID, [Security Associates Query].[Last Name], [Absenteeism Query].[First Day], [Absenteeism Query].[Last Day], DateDiff("d",[First Day],[Last Day])+1 AS Expr1, [Absenteeism Query].I
FROM [Security Associates Query] INNER JOIN [Absenteeism Query] ON [Security Associates Query].ID = [Absenteeism Query].I
WHERE ((([Absenteeism Query].[Last Day])>IIf(DMax("[Last Day]","Absenteeism Query")<Date()-183,#1/1/2199#,#1/1/1988#))
ORDER BY [Absenteeism Query].[Last Day]

When I add [Security Associates Query].[Last Name]=[name] to the query, the WHERE ((([Absenteeism Query].[Last Day])>IIf(DMax("[Last Day]","Absenteeism Query")<Date()-183,#1/1/2199#,#1/1/1988#))) statement doesn't work for that employee.
I tried to add [Last Name]=[name] to the Security Associate Query, but in both cases the WHERE statement does not work.
Can somebody plese help me
 
Top