473,417 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,417 software developers and data experts.

AutoNumber Issue

Hi All,

I am writing a program in C, which will be driving via a MS Access database.
I am relitivly new to database design, so if anyone could help me with my
issue I would be greatful.
I have defined a database field to be a primary Key, this field is set to
contain the AutoNumber data type.
I would like to know if it is possible to start the autonumber sequence from
a number other than 0.

Thanks
Nov 28 '05 #1
2 1736
See:
Set AutoNumbers to start from ...
at:
http://allenbrowne.com/ser-26.html

You can also set the Seed of the Autoincrement column using ADOX if you use
a JET 4 database format.

--
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.

"Materialised" <ma**********@privacy.net> wrote in message
news:3v*************@individual.net...

I am writing a program in C, which will be driving via a MS Access
database.
I am relitivly new to database design, so if anyone could help me with my
issue I would be greatful.
I have defined a database field to be a primary Key, this field is set to
contain the AutoNumber data type.
I would like to know if it is possible to start the autonumber sequence
from a number other than 0.

Nov 28 '05 #2
This SQL will alter your column assuming the column meets the
requirements for autonumber and you are using JET 4.0.

"ALTER TABLE Table1 ALTER COLUMN ID Identity (200,10)"

Notes:

(200, 10) -> seed:200; increment:10
1. You must run the SQL from an OLEDB interface (ADO is a common OLEDB
interface; in Access one can use
Application.CurrentProject.Connection.Execute; DBengine and CurrentBD
are not part of an OLEDB interface);
2. If the table already has records numbered 1,2,3,4 etc, their
autonumber will not be changed (even if you remove the autonumber
column and start over);
3. the next record appended will have an autonumber of 200; if there
already is an autonumber of 200 then the append will fail (assuming a
primary key or not allow duplicates index).

Nov 28 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Lee C. | last post by:
I'm finding this to be extremely difficult to set up. I understand that Access won't manage the primary key and the cascade updates for a table. Fine. I tried changing the PK type to number and...
1
by: BT Openworld | last post by:
I've just had to upgrade to Access 2003. Our company's main sales database started in Access V1.0 and has progressed through V2.0 and 97 without problems. I've converted it to 2003 format and have...
35
by: Traci | last post by:
If I have a table with an autonumber primary key and 100 records and I delete the last 50 records, the next record added would have a primary key of 101. Is there any way to have the primary key...
1
by: larry | last post by:
Hi there The table in question now has around 25000 records (simple -only 3 columns) Records are added with a simple insert statement : INSERT INTO SS_REQUEST_SERVICES ( REQUEST_ID,...
1
by: jimfortune | last post by:
Sometimes I use Autonumber fields for ID fields. Furthermore, sometimes I use those same fields in orderdetail type tables. So it's important in that case that once an autonumber key value is...
8
by: petebeatty | last post by:
I have created a SQL string the properly inserts a record in the table. However, the insert does not occur at the end of the table. Instead it inserts a record after the last record that I viewed....
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
0
by: Macbane | last post by:
Hi All, Hope someone can help me with this. I have some PDA database software which sync with tables in an access database on my computer. It works fine until you want to sync tables that...
9
by: Tom_F | last post by:
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.