473,326 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Only pull latest entry from a table

I have a table with a Date Field. This field is populated with the
date and time an entry was made to the table.

I am looking to create a query that pulls only the most recent record.
I am pretty sure this is done with the DMax function but I don't know
how to build the code.

Date field is named "Date"
Table is named "ABC"

Can you include the actual code in your response??
Any help is greatly appreciated...

Chris

Nov 13 '05 #1
3 2379
Rog
Make it a "totals" query (klick on the totals button on the query
design toolbar), which gives you an extra line in the query labeled
Total. Select the date field and select "Max" on the total line. Now
only the last date will appear.

By the way, it's best to rename your field to fldDate or such, Date
refers to today's date if you use it in code.

Nov 13 '05 #2
"Fatz" <cc******@ibtco.com> wrote:
I have a table with a Date Field. This field is populated with the
date and time an entry was made to the table.

I am looking to create a query that pulls only the most recent record.
I am pretty sure this is done with the DMax function but I don't know
how to build the code.


Chris,

You don't need code.

Create a select query and sort the recordset 'descending' on the date
field. This will give the latest record first.

Next, in the query properties, set the 'top values' property to '1'.

Note - if records are 'bulk' updated and therefore contain the same
timestamp then this method will return all of those records.

HTH - Keith.
www.keithwilby.com
Nov 13 '05 #3
"Rog" <de********@state.gov> wrote:
Make it a "totals" query (klick on the totals button on the query
design toolbar), which gives you an extra line in the query labeled
Total. Select the date field and select "Max" on the total line. Now
only the last date will appear.


How would you include other fields using this method?
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Scott Frankel | last post by:
Still too new to SQL to have run across this yet ... How does one return the latest row from a table, given multiple entries of varying data? i.e.: given a table that looks like this: color...
1
by: Alan | last post by:
Hello World: I have a new task at work. I have to process a mainframe report (a text file), and put it into an Access 2003 database. When I get the report, it looks like this: Account Sub_Name...
4
by: sparks | last post by:
We have a new project here, one that I have never tried maybe its easy I don't know yet. We have people that have records dating back over 5 yrs on a sql server. We have to build an access 2003...
2
by: rush81 | last post by:
Hello All, I want to pull data against two fields from table. The combination of these fields give unique result like '123 VA' or '0123 VA' One field has entries like 0123 and 123, one entry with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.