Siegfried
It sounds like you are using the worker's name as a primary key. This is
risky, as you might hire more than one "John Smith". Consider, instead,
using an employee number (if you have these), or even an Access Autonumber
field as a primary key.
Next, consider keeping two tables, not one. One table holds information
about employees. Name, address, date started, date terminated, ...
The second table is a "timesheet" table (for lack of a better term). This
table contains a record ID (again, Autonumber works fine for this), a
PersonID (from the Person/Employee table), a start date/time and a stop
date/time.
With this design, you can use a query to find the Max([Stop Date/Time])
value for each EmployeeID (a Totals query, grouped by EmployeeID and showing
Max([Stop Date/Time]).
To find the "second" most recent, build a second query that finds the
Max([Stop Date/Time]) per EmployeeID WHERE that is NOT in the previous
query. In more english-like terms, find the (next) most recent StopTime
after finding the most recent StopTime.
Regards
Jeff Boyce
Microsoft Office/Access MVP
"Siegfried Heintze" <siegfried@heintze.com> wrote in message
news:%23cU1D0kwGHA.4408@TK2MSFTNGP02.phx.gbl...
|