Add autonumber in existing table

  • Thread starter Thread starter Photios_Kim
  • Start date Start date
P

Photios_Kim

Hi,
I am trying to change the Case Number field which field type is Number
to autonumber field in multiuser envirorment. I have to keep the old
data in the table and when users open the CaseAdd form, it will
generate Case number automatically.
Could anybody help me to solve this problem?

Many thanks in advance.
 
You can't convert an existing number field to an autonumber. Additionally,
you probably don't want to use an autonumber field to store your Case
number, since it is common for values to be skipped. You might try adding
the necessary code to automatically generate your Case number to the
Form_BeforeInsert event. If you need to see the new Case number on the form
before the record is added, you could generate it in the Form_Current event.

HTH,

Carl Rapson
 
Thank you for your help, Carl. If you don't mind, please humor with
me, does Form_BeforeInsert event mean BeforeUpdate even or other event?
Is this event can be worked on multiuser envirorment?

Thank you,
 
Forms have both a BeforeInsert event and a BeforeUpdate event. Which one
fires depends on whether you are adding a new record or updating an existing
record. I would think an existing record would already have a Case number,
so I mentioned the BeforeInsert event.

As far as I know, these events work fine in a multi-user environment. There
is always the possibility that two users could be executing the BeforeInsert
event at exactly the same time, resulting in duplicate Case numbers, but
since the code usually executes so quickly I think that's a very remote
possiblity. I've certainly never had any problems with this method in
multi-user situations.

Carl Rapson
 
Back
Top