Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query date field for most recent date

Status
Not open for further replies.

jaegca

Instructor
Dec 5, 2001
20
US
I need to write a query to capture only the most recently imported data into a table (put a "Date()" default field in table) which populates when I import the data - search MS ACCESS help and Microsoft's site, even keyword search here and must not be using the correct terminology - any assistance is greatly appreciated
 
From what source is the imported data coming? And what method are you using to import it?

-chris
 
What you could do is create a Totals query with one field, MaxOfDateField. Then add that query to your other query, join the DateField to MaxOfDateField. This should return on those records that match the MaxOfDateField value.

Paul
 
The data source is a hospital database (McKesson Star) - the import will be accomplished by running a Star SQL that downloads to the end-users C:\ drive - then a macro button will import to a table that stores all the employee historical data - I wanted to use the date field to capture the most recently imported data, append to a new table which will be the source of most recent info & capture new name, job code, manager, dept etc. info - does that make sense?
 
So you're saying all the data is already imported into Access, and what you want to do is create a new table with just the most recently imported ones?

If so, firstly I'd ask why is this necessary? If you just want to work with the most recent dates, base your form (or report) on a query which selects these. eg, using a query with this criteria under your Date column:

Between Date() AND DateAdd("m",-1,Date())

will give you all records for one month prior to the current date, or:

Between Date() And DateAdd("d",-7,Date())

will give the last weeks records.

If it is really necessary to have a separate table, then use a make table query with the above criteria.

HTH Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top