Return record with date closest to today based off unique identifier field

number1pita

Board Regular
Joined
Oct 8, 2013
Messages
51
Hello,

I am capturing changes from a non-Access database by pulling daily extracts of anything that changes using the last updated field as my trigger to know if something changed. Everyday I get a report for any records updated yesterday and my Access database knows to update the tables adding the new records. It doesn't replace the old, because we want to keep that historical perspective. My only problem is, I need to build a query where it will pull all the current data and leaving out the old records. So I am trying to figure out how to create a query that will pull in all the fields, but only return the most recent "lastupdated" field based off the unique identifier field of "engagementid".

Any help on this would be greatly appreciated, because I am at a complete loss.

Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
from a non-Access database
You mean changes in an Access database, because you're working in an Access database? You will probably need a query with a sub query (a sql statement as criteria) where the sub returns the Max([lastupdated]). You can research sub queries if you've never created one; they do have a couple of unique requirements. Without a copy of your db or at least some data, I'm not able to even attempt if for you.
 
Last edited:
Upvote 0
Yes, in a sense, capturing changes in Access of data from another database.

Thank you so much! This helped! I did a little research on what a sub query was and was able to get it to work. I figured I needed to do max of lastupdated field, but was trying it with all the other fields in the query and it wasn't returning only the one instance of the unique identifier, but now this totally makes sense on why. Appreciate it!
 
Upvote 0
Awesome! I they can be a life saver, but sometimes I still struggle to get the dang thing working right off the bat.
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top