+ Reply to Thread
Results 1 to 1 of 1

Thread: How to set an autonumber (easy method)

  1. #1
    Barn Enthusiast sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69's Avatar
    Join Date
    Mar 2008
    Location
    The frigid northern plains
    Posts
    432
    Rep Power
    7

    How to set an autonumber (easy method)

    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:
    Code:
    ALTER TABLE MyTable ALTER COLUMN MyAutoNumber COUNTER(10200,1);
    
    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.

    I am including a numbered diagram as well as a sample database.

    Hope this makes your life just a little bit easier! Enjoy!
    Last edited by sbenj69; March 18th, 2009 at 05:52 PM.
    Join our Folding team: DeveloperBarn Folding
    -----------------------------------
    Folding Stats - Stanford University
    Folding Stats - Extreme Over-Clocking
    Folding Stats - Kakao Stats
    Folding Stats - Xtreme CPU

    -----------------------------------

+ Reply to Thread

Similar Threads

  1. Replies: 8
    Last Post: June 17th, 2008, 10:39 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO