I think that the best way to handle the OP's problem is to have an
otherwise unreferenced date field in the Table with a Default value of
Now(). The most recently entered record will always be the one with
the maximum value in this field.
i agree with you, Peter, i would use a date field with a programmatically
assigned value, too. but i probably wouldn't use the DefaultValue to assign
it. in a data entry form, as soon as the user saves a record and the cursor
goes to the next "new" record, the default value is set. but the user may
not actually begin to enter data in the new record for minutes, or hours. in
the meantime, any number of additional new records may be entered and saved
by other users.
i usually add date/time stamps to records on the form's BeforeUpdate event,
using an If statement to test for NewRecord. that's not 100% foolproof
either, of course; this is essentially the same issue we face when creating
an incremental unique value (like a purchase order number) for a record at
point-of-entry, in a multi-user environment. the issue has been debated in
these newsgroups numerous times, but i've never seen anyone post a foolproof
solution. <g>
Peter R. Fletcher said:
In fact, it is guaranteed _not_ to work with a Random AutoNumber
primary key (the more records in the Table, the lower the probability
that a random new key will be greater than the highest previous one)!
I think that the best way to handle the OP's problem is to have an
otherwise unreferenced date field in the Table with a Default value of
Now(). The most recently entered record will always be the one with
the maximum value in this field.