Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    9

    Unanswered: Autonumber field

    Hi.

    Does anyone know how to start an Autonumber field at a specific number? For example when a table is created and includes an Autonumber field. Instead of starting the number at 1 (default), suppose I wanted to start at 999? How can I update the field to show this?

    Thanks.

  2. #2
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    There is a very good example of this on the Dev Ashish web site. Do a search on autonumber.

    http://www.mvps.org/access/index.html

  3. #3
    Join Date
    Jul 2003
    Posts
    292
    create a table..

    say.. "NextID" field "NextID"

    now write this function (GetID).. and call it eveytime you need it...
    Code:
    Function GetID() As Long
       Dim NextID As Long
       NextID = DLookup("NextID", "NextID")
       CurrentDb.Execute "update NextID set NextID=NextID+1", dbFailOnError
       GetID = NextID
    End Function
    remember to go into your table and set it to whatever number you want it to start with....

  4. #4
    Join Date
    Jul 2003
    Posts
    9
    Many Thanks, I'll try this out.

Posting Permissions

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