Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 29th, 2006, 06:21 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Autonumber Query

Hi All
Is it possible to start an autonumber from a particular number.So instead of starting at 1 start at 1575


Brendan Bartley
Brendan Bartley
Reply With Quote
  #2 (permalink)  
Old June 30th, 2006, 07:03 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

If you clear the table completely and then compact and repair the database, it'll always reset to 1. You cannot force it to start elsewhere nor guarantee that the numbers will always be sequential, especially when you start deleting data in the middle.

Autonumbers are not meant to hold any meaningful value at all. Their purpose is merely to set a unique identifier to the record so you can reference it. Therefore, you'd never worry about where it starts or if it's a "logical" number.

If you need a number that has meaning, create your own indexed field in the table and populate it yourself. Don't use autonumber.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #3 (permalink)  
Old July 16th, 2006, 02:14 AM
Friend of Wrox
Join Date: Jul 2005
Location: Oklahoma City, OK, USA.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts

Yes, you can.. to do this:

Create the first table that contains the counter type field that you want to start on another number. Don't enter any records.Create a second table, with a single long integer number type field that has the same name as the counter field in the first table. Create a record in the second table by entering a number one less than the number you want to start the counter at in the first table. Create an append query, to append the one record in the second table to the first table, and run it Delete the second table, delete the record that you appended to the first table, and start entering data.

Alternative method:

You can make an Append query that just appends a value from a parameter, to just the auto-number field (as long as no other fields are required), e.g.:

PARAMETERS [Number] Long;
INSERT INTO tblAuto ( intNumber )
SELECT [Number] AS Expr1;

"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Autonumber problem mankoti_mankoti2000 Access 6 August 29th, 2006 12:28 AM
Autonumber in a query crisan Access 2 May 11th, 2005 07:58 AM
AutoNumber Assignments jackDaniels SQL Server 2000 10 February 10th, 2005 12:32 AM
regarding Autonumber... MuthuAL Classic ASP Databases 2 December 8th, 2004 08:04 AM
AutoNumber Conundrum enterbase Access VBA 4 January 28th, 2004 05:29 PM

All times are GMT -4. The time now is 06:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.