when I try to restore an old record the autonumbering logic will give the
next available index number and I cannot force access to accept the original
index value. Therefore I use non-autonumbered index fields. The nice thing
about autonumbers though is that it allocates a unique number and what I want
is to immitate this unique number logic without using autonumbering. This way
when I restore data, records do not get overwritten - which can happen when
the record with the highest number is deleted by the user after the data was
backed up and a new record is allocated with the same index. when you restore
now the record gets overwritten.
I hope this sheds some light into my situation....
thanx for looking at my post.
Klatuu said:
You can emulate Autonumbers, but you have to be careful in a multi user
environment. It is easy enough to determine the highest current number and
add 1 to it:
Dim lngNextNum As Long
lngNextNum = Nz(DMax("[KeyField]", "MyTable"),0) + 1
But in a multi user environment, 2 users could get the same number and the
second to try to save will fail. You would have to use some error trapping
and increment the number until you get a good save.
Out of curiosity, what problems have you had restoring data using autonumbers?
--
Dave Hargis, Microsoft Access MVP
Henry said:
I would like to stay in control and determin myself what Number to add as
index value. Is there way to add unique values just without using the
AutoNumber feature in my index field? AutoNumber is a problem when you need
to restore data...