Are primay key autonumber fields chronologicaly ordered?

jjh

Registered User.
Local time
Today, 11:02
Joined
Jun 7, 2006
Messages
32
Rephrasing: I have a table that has a PK that is autonumber. As I add records, the PK number always increases, with the last entry always larger than the previous (but the PKs may not always contain the next number in the sequence, e.g. 2,4,6, instead of 2,3,4). I need to do a query on this table to get fields from the most recent record that was added.

So, If I do a sort on the PK field and get the record with the largest primary key, am I assured that this is always the most recently added field????

If not, how can I construct a query that will provide me with the most recently entered record?

Why I need to do this: I do a query on table 'A' and then append one record from A to table 'B'. Then, using the record I just copied, I do an append query on another table and then place those results in yet another table.

Or, is there another way to accomplish this?
Thanks
J
 
If you want to the most recently added record, add a timestamp field.
 
Surly the last record is the one with the largest autonumber unless of course the auto number reset itself - I have seen this happen but at least the new autonumber sequence did not overlap the original.
 
Dennisk said:
Surly the last record is the one with the largest autonumber
Not necessarily. You can set a random autonumber which randomly jumps between the range of a long integer, including negative values.
 
Use Max() on the autonumber in an aggregate query.
 
Again, as SJ mentioned, add a date/time stamp. Do NOT rely on Autonumber to always be incremented and that the highest number is the most recently added. Autonumber is ONLY guaranteed to generate a UNIQUE number, not necessarily a number in a certain order. If you ever move to replication, it will definitely become random like SJ has mentioned.
 
SJ McAbney said:
If you want to the most recently added record, add a timestamp field.

OK, TYVM...But, in thinking about this situation a bit more, I will have the results of the query in the dynaset before I do the append (correct?). My application will always result in exactly one record being in the dynaset. Is it possible do a query on the dynaset fields, get the piece of info I want, and then use that as the criteria in another append query??? If so, how do I do this?
Thanks
J
 

Users who are viewing this thread

Back
Top Bottom