How to find the nearest date?

  • Thread starter Thread starter Gigiho
  • Start date Start date
G

Gigiho

SOS.......a donor gave moeny twice, how to set query to find the donation
nearest date? PLs HELP...
 
SOS.......a donor gave moeny twice, how to set query to find the donation
nearest date? PLs HELP...

Without knowing anything whatsoever about the structure of your tables, how
could anyone possibly answer?

Please explain. remember that you can see your screen and we cannot.
 
sorry, sorry!!!
my table structure has: name, surname, donation type, donation amount and
donation date.
at my query, I have set [donation day:date()-donation date] to show the day
distance from today, i.e. smallest is the nearest. I don't know how to show
only the nearest one.
 
Build a query saved as qMostRecentDonation

SELECT Name, SurName, Max([Donation Date]) as LastDonated
FROM [Your Table]
GROUP BY [Name], Surname

You can build that in design view by
-- adding the three fields
-- Selecting View: Totals from the menu
-- Changing GROUP BY to MAX under the Donation Date field.

If you want additional field for this record then
--create a new query with your table and this query.
--Join the table and query on the fields Name, Surname, and donation date.
--Display the fields from the table that you want to see.

If you need an updateable query, you will need to use a correlated subquery in
a where clause to find the specific records. With a large set of records this
type of query is fairly slow. Post back if you really need to do this.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
sorry, sorry!!!
my table structure has: name, surname, donation type, donation amount and
donation date.
at my query, I have set [donation day:date()-donation date] to show the day
distance from today, i.e. smallest is the nearest. I don't know how to show
only the nearest one.


John W. Vinson said:
Without knowing anything whatsoever about the structure of your tables, how
could anyone possibly answer?

Please explain. remember that you can see your screen and we cannot.
 
Back
Top