Results 1 to 2 of 2
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Rest autonumber (Access 2000)

    You could run the code again after copying the table(s) to another database.

    If the sequence values are really important to you, you shouldn't use an AutoNumber field, but a standard Number field, and assign values in code (from a form).

  2. #2
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reset autonumber (Access 2000)

    Subject edited by HansV (rest > reset)

    I have a function to reset the autonumber.It works well however only in a given database.When i copy the tables into other databases, the reseted autonumber disappears and again it begins with 1. Is it possible to avoid this and preserve the new number into the other databases ?
    Public Function ResetAutonumber()

    Dim rate As Double
    Dim So As Double
    Dim Va As Double
    Dim Bl As Double
    Dim Ha As Double
    Dim Pl As Double
    Dim Ta As Double
    Dim Tr As Double
    Dim Sz As Double
    Dim Bs As Double

    So = 1
    Va = 10000
    Bl = 20000
    Ha = 30000
    Pl = 40000
    Ta = 50000
    Tr = 60000
    Sz = 70000
    Sz = 80000
    Bs = 90000

    CurrentDb.Execute "ALTER TABLE CallsClientsSo ALTER COLUMN CallID COUNTER(" & So & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsVa ALTER COLUMN CallID COUNTER(" & Va & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsBl ALTER COLUMN CallID COUNTER(" & Bl & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsHa ALTER COLUMN CallID COUNTER(" & Ha & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsPl ALTER COLUMN CallID COUNTER(" & Pl & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsTa ALTER COLUMN CallID COUNTER(" & Ta & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsTr ALTER COLUMN CallID COUNTER(" & Tr & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsSz ALTER COLUMN CallID COUNTER(" & Sz & ",1)"
    CurrentDb.Execute "ALTER TABLE CallsClientsBs ALTER COLUMN CallID COUNTER(" & Bs & ",1)"
    End function

Posting Permissions

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