A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access AutoNumber Feature



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2004, 04:43 PM
Keith Davis
external usenet poster
 
Posts: n/a
Default Access AutoNumber Feature

Is there a way to get the AutoNumber feature in Access to
begin incrementing at a number other than 1? For example,
to begin the numbers assigned to a customer ID field at
4001 instead of 1. The AutoNumber field would then
generate 4001,4002,4003,4004, etc for each successive
field.

Thanks in advance!
  #2  
Old May 19th, 2004, 04:58 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default Access AutoNumber Feature

Simplest approach is to programmatically add a record 1 less than you want,
and then delete it. Provided you do not compact before records are added,
they will begin where you want.

Details:
Set AutoNumbers to start from ...
at:
http://allenbrowne.com/ser-26.html

In Access 2000 and later, it is possible to achieve the same result by
setting the Seed property of the automumber column using ADOX code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Keith Davis" wrote in message
...
Is there a way to get the AutoNumber feature in Access to
begin incrementing at a number other than 1? For example,
to begin the numbers assigned to a customer ID field at
4001 instead of 1. The AutoNumber field would then
generate 4001,4002,4003,4004, etc for each successive
field.

Thanks in advance!



  #3  
Old May 19th, 2004, 05:17 PM
Pavel Romashkin
external usenet poster
 
Posts: n/a
Default Access AutoNumber Feature

Although Allen is indeed correct, there is a simpler way. All you need
to do is run an INSERT query on a new, blank table with AN that will put
4000 into the AN field:

INSERT INTO MyTable (myAutoNumber) VALUES (4000)

Pavel

Keith Davis wrote:

Is there a way to get the AutoNumber feature in Access to
begin incrementing at a number other than 1? For example,
to begin the numbers assigned to a customer ID field at
4001 instead of 1. The AutoNumber field would then
generate 4001,4002,4003,4004, etc for each successive
field.

Thanks in advance!

  #4  
Old May 19th, 2004, 05:47 PM
Keith Davis
external usenet poster
 
Posts: n/a
Default Access AutoNumber Feature

Thanks for the help Pavel. Could you point me in the
direction of where I could find information in performing
an Insert Query? Is this the same as an Append or Update
query?


-----Original Message-----
Although Allen is indeed correct, there is a simpler

way. All you need
to do is run an INSERT query on a new, blank table with

AN that will put
4000 into the AN field:

INSERT INTO MyTable (myAutoNumber) VALUES (4000)

Pavel

Keith Davis wrote:

Is there a way to get the AutoNumber feature in Access

to
begin incrementing at a number other than 1? For

example,
to begin the numbers assigned to a customer ID field at
4001 instead of 1. The AutoNumber field would then
generate 4001,4002,4003,4004, etc for each successive
field.

Thanks in advance!

.

  #5  
Old May 19th, 2004, 06:04 PM
Pavel Romashkin
external usenet poster
 
Posts: n/a
Default Access AutoNumber Feature

Insert is actually what the Access query designer calls Append. All you
have to do is click on Create new query, cancel the table selection
dialog that comes up, then right-click and choose "SQL view". Type the
statement you need and press the [!] on the tool bar to run the query.
Make sure that you replace [myAutoNumber] in my suggestion with the name
of your field (I guess it would be CustomerID or something like that).

Pavel

Keith Davis wrote:

Thanks for the help Pavel. Could you point me in the
direction of where I could find information in performing
an Insert Query? Is this the same as an Append or Update
query?

-----Original Message-----
Although Allen is indeed correct, there is a simpler

way. All you need
to do is run an INSERT query on a new, blank table with

AN that will put
4000 into the AN field:

INSERT INTO MyTable (myAutoNumber) VALUES (4000)

Pavel

Keith Davis wrote:

Is there a way to get the AutoNumber feature in Access

to
begin incrementing at a number other than 1? For

example,
to begin the numbers assigned to a customer ID field at
4001 instead of 1. The AutoNumber field would then
generate 4001,4002,4003,4004, etc for each successive
field.

Thanks in advance!

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.