Every once in awhile, I make databases with autonumbers that I don't necessarily want to start at one (1). For example, if I was to make a check register, I might want to start at 1000 or something. There is a really easy way to do this (My example is in MS Access 2003).
There is a more intense method detailed here----> Allen Browne Tutorial
Ok, let's start:
I'm going to make a table with two fields; the table is called MyTable.
MyTable
MyAutonumber - autonumber
MyBogusText - text
Next, you will want to go to queries, click on design view, and click close on the "Show Table" box. Then on the file menu, click on "Query", scroll down to "SQL Specific", and then choose "Data Definition". You will then have a blank box in which to type your data definition instructions. For my database, the code is this:This resets the autonumber to start at 10200, and increments by 1. If I wanted to start at a different number, then I would change the first number. If I wanted it to increment by say 10, I would change the second number to 10. Save the data definition. All you have to do now, is run it. It will give you a warning, you will allow it to run, and that's it. You don't have to run it again, and the autonumber starts at 10200.Code:ALTER TABLE MyTable ALTER COLUMN MyAutoNumber COUNTER(10200,1);
I am including a numbered diagram as well as a sample database.
Hope this makes your life just a little bit easier! Enjoy!



LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks