By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

AutoNumber Issue

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.