Autonumber problem

  • Thread starter Thread starter Candiz
  • Start date Start date
C

Candiz

I have a next number field bound to another field that is a four digit year
field. The problem I'm having is when I entered data on the year field and
decided to cancel, the next number field writes the next number. The cancel
(undo) button only works when there is no data entered on the year field. I
want the next number field to undo the record when I click the Cancel
button. Can this be done? I appreciate any help from the experts.

Happy Holidays
 
Hi,


Autonumber are not to be use if you want an un-interrupted sequence.

Try using

1+Nz(DMax("AutomaticSequenceNumberFileNameHere", "MyTableNameHere"), 0)

for your sequence. In multi-users environment, index it, without duplicated
value, and, in the form, capture the possible error that may occur if two
users try to use the same number, in the onError FORM event. When there, an
error occurred about the user trying to add a sequence number already saved
(by the first user, being faster that this second one for which the error
occurs), since no duplicated values are allow, just re-compute 1+Nz(DMax(...
and try to save again, with this new sequence number.




Hoping it may help,
Vanderghast, Access MVP
 
Back
Top