query to retrieve most recent information

M

mcnews

i need to create a query that will return the most recent information
for a given person. each person may have multiple name, address,
telephone, and/or event records. the event record will contain an
entry date.
so my questions are:
what's the best way to keep these records in sync and
how to build a query to retrieve the data as needed.

tia, mcnewsxp
 
M

mcnews

i need to create a query that will return the most recent information
for a given person. each person may have multiple name, address,
telephone, and/or event records. the event record will contain an
entry date.
so my questions are:
what's the best way to keep these records in sync and
how to build a query to retrieve the data as needed.

tia, mcnewsxp

i just reread my post and it does not describe what i need. drifted
off somewhere....

i just need to know how to use a date field in a query to retrieve the
most recent of a set of records.

tia,
mcnewsxp
 
J

John Spencer

Best Guess is you need a subquery. However since I have no clue about your
table structure, the following is a rather generic SQL statement.


SELECT YourTable.*
FROM YourTable
WHERE EntryDate =
(SELECT Max(entryDate)
FROM YourTable as Tmp
WHERE Tmp.PersonID = YourTable.PersonID)

Check out Allen Browne's page on subqueries.
http://allenbrowne.com/subquery-01.html

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
S

Steve

The most recent date is the max date in your date field. To get the max date
for each person:
1. Open your query in design view.
2. Click on the Sigma (looks like capital E) button in the menu at the
top of the screen.
3. Go to your date field in your query and change Group By to Max.
4. Run your query.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top