Query for most recent entry

  • Thread starter Thread starter Janet
  • Start date Start date
J

Janet

I am creating an online database for our school employees
to be able to enter their walking miles every week. I'm
doing this using a web page, form, and then Access
database connection on our server.

Some employees may enter their information, realize it's
wrong and want to re-enter.

I'd like help with designing a query that pulls of the
last entered entry per user.

My final step will be to post the ongoing results on a web
page using the database results wizard.

I'm stuck on the query and getting the last entered data.

Thanks for your help!
Janet
 
I'm stuck on the query and getting the last entered data.

If you have a date/time field indicating when the record was entered
(or when the walking occurred), you can use a Query with a criterion
like

=DMax("[Datefield]", "[your-table-name]", "[EmployeeID] = " &
[EmployeeID])

to find the most recent record for the current employee.

John W. Vinson[MVP]
(no longer chatting for now)
 
Table and fields would be helpful, but here is a generic query (in SQL) that may
help you. Replace table and field names with your table and field names.

SELECT T.EmployeeID, T.WalkDate, T.WalkDistance
FROM YourTable As T
WHERE T.WalkDate =
(SELECT Max(S.WalkDate)
FROM YourTable as S
WHERE S.EmployeeID = T.EmployeeID)
 
Back
Top