Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Add autonumber in existing table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Photios_Kim@nstaronline.com - 28 Apr 2005 14:57 GMT
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.
Carl Rapson - 28 Apr 2005 15:16 GMT
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

> Hi,
> I am trying to change the Case Number field which field type is Number
[quoted text clipped - 4 lines]
>
> Many thanks in advance.
Photios_Kim@nstaronline.com - 29 Apr 2005 14:56 GMT
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,
> 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
[quoted text clipped - 13 lines]
> >
> > Many thanks in advance.
Carl Rapson - 29 Apr 2005 15:12 GMT
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

> 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?
[quoted text clipped - 27 lines]
>> >
>> > Many thanks in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.