How to retrieve record that was appended last?

G

Guest

Hello,
I have a table populated by an append query. The append query appends those
records from the source table whose 'model-Nr' field has changed. I want my
append query to compare the record in the destination table with the same
'index key' field and that which was appended most recently.
this is because the append query compares all the records with the same
'index key' field and then appends so many records.
whereas, I want to compare the record appended most recently in the
destination table and the corresponding record in the source table.



both the tables are related through the 'Index key' field.
relation type is' include all the records from the source table and include
only those records from the destinaiton table that are equal'.
index key field is unique for every record.
 
J

Jeff Boyce

Joshua

"appended most recently" requires knowing when a record was appended. Do
you have a date/time field you put Now() into when you append records?
 
G

Guest

Hi Jeff,
I do have a field with a date() function..the changes do not require a now()
function in my case.
still, I am not sure how to comapre them.
can u give a sample code or something like that?
Thanks
Joshua
 
R

Rick Brandt

Joshua said:
Hi Jeff,
I do have a field with a date() function..the changes do not require
a now() function in my case.

If you append more than one record a day then you DO need to use Now()
instead of Date(). There is no intrinsic property that keeps track of which
records were inserted first or last. You have to have a field in the table
that will hold that information. Then its'; simply a matter of doing a
SELECT TOP 1... query sorting in descending order on that field.
 

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