autonumber

  • Thread starter Thread starter andymed
  • Start date Start date
A

andymed

I have a prime number (autonum) in format "IF-04-"000 so
it reads as IF-04-001 next record IF-04-002 and so on.
Once it becomes 2005 I need to change to IF-05-001 and
continue like i did from the beginning. Not only changing
the 05 but also starting it at 001 again.
 
andymed said:
I have a prime number (autonum) in format "IF-04-"000 so
it reads as IF-04-001 next record IF-04-002 and so on.
Once it becomes 2005 I need to change to IF-05-001 and
continue like i did from the beginning. Not only changing
the 05 but also starting it at 001 again.

You cannot do this with an AutoNumber. Change it to a Long Integer and
then use code in your form when records are inserted to calculate the next
number to use.

If the prefix "IF-" is never going to change you don't need to store that
at all. If it were me I would also store the two other numeric "pieces" in
separate fields and then concatenate them together in the desired format
for display on forms and reports. That would make calculating the next
number a lot easier by being able to use DMax() on the two individual
fields to determine what the next value should be for both fields.
 
Autonumbers are unique, not consecutive numbers. You can not count on
them to be in any specific order. Generally it is not a good idea to even
let the user see them. They are good for forming joins between tables when
normalizing.

It appears you should be creating a new account number or whatever it
is, using your own code to create the number in a text field.
 
Back
Top