C
CEV
I have a form based on a query. The SQL View of the query is shown below.
The report is showing me all records for the PositionNumber. Each
PositionNumber can have more than one record as employees come and go. The
PositionNumber can also have the Schedule or Title changed when a different
employee starts that position. When this happens is when it shows me the
different records for one PositionNumber. I only need it to show me the
record with the most recent DateEnded date. I can add DateEnded to the query
but am unsure how to make look at only the most recent date. I am not
familiar with SQL yet so I have always used the Design View when possible to
create the queries.
SELECT tblPositions.PositionNumber, tblPositions.Department,
tblEmployeePositions.Title, tblPositions.Notes,
tblEmployeePositions.Schedule, tblPositions.Inactive
FROM (tblPositions LEFT JOIN qryFilledPositions ON
tblPositions.PositionNumber = qryFilledPositions.PositionNumber) INNER JOIN
tblEmployeePositions ON tblPositions.PositionNumber =
tblEmployeePositions.PositionNumber
GROUP BY tblPositions.PositionNumber, tblPositions.Department,
tblEmployeePositions.Title, tblPositions.Notes,
tblEmployeePositions.Schedule, tblPositions.Inactive,
qryFilledPositions.PositionNumber
HAVING (((tblPositions.Inactive)=No) AND
((qryFilledPositions.PositionNumber) Is Null));
Thanks,
Chad
The report is showing me all records for the PositionNumber. Each
PositionNumber can have more than one record as employees come and go. The
PositionNumber can also have the Schedule or Title changed when a different
employee starts that position. When this happens is when it shows me the
different records for one PositionNumber. I only need it to show me the
record with the most recent DateEnded date. I can add DateEnded to the query
but am unsure how to make look at only the most recent date. I am not
familiar with SQL yet so I have always used the Design View when possible to
create the queries.
SELECT tblPositions.PositionNumber, tblPositions.Department,
tblEmployeePositions.Title, tblPositions.Notes,
tblEmployeePositions.Schedule, tblPositions.Inactive
FROM (tblPositions LEFT JOIN qryFilledPositions ON
tblPositions.PositionNumber = qryFilledPositions.PositionNumber) INNER JOIN
tblEmployeePositions ON tblPositions.PositionNumber =
tblEmployeePositions.PositionNumber
GROUP BY tblPositions.PositionNumber, tblPositions.Department,
tblEmployeePositions.Title, tblPositions.Notes,
tblEmployeePositions.Schedule, tblPositions.Inactive,
qryFilledPositions.PositionNumber
HAVING (((tblPositions.Inactive)=No) AND
((qryFilledPositions.PositionNumber) Is Null));
Thanks,
Chad