Custom AutoNumber at table level

B

Brendanpeek

I require a field to increase in number each time a record is created without
but the code in at query or form level.

I already have the required field with Data in it wich i cannot lose such as

NRTSS0001
NRTSS0002
NRTSS0003
......

All i need is the number to increase keeping the letter the same.

Plus if say the record with NRTSS0456 was deleted i need to number to be
used next.

Thank you for your time.
 
A

Allen Browne

Use the BeforeUpdate event procedure of the form to assign the next
available number, if the key field is null. I suggest Form_BeforeUpdate,
because this is the last possible moment before the record is saved, and so
it reduces the chance that 2 users will be assigned the same key value.

You will need some experience with VBA to do this.

If all records have the same prefix, you would leave that part out of the
field, and concatenate it for display purposes. You may even be able to use
an AutoNumber.

I am not convinced it is a good design to go back and fill the holes where
records were deleted.
 
Top