Results 1 to 6 of 6

Thread: autono (2k)

  1. #1
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    autono (2k)

    I want to do autonumber start from 10000 .
    Ashraf

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

    Re: autono (2k)

    In the following, I will call the table in which you want to set the start value for the AutoNumber field the 'target' table.


    Create a temporary table with one field of type Number, Long Integer.
    Give the field the same name as the AutoNumber field in the target table.
    Create one record in the temporary table by entering the value 9999 (one less than the starting number you want)
    Create a query based on the temporary table.
    Add the field to the query grid.
    Change the query to an append query (Query | Append...) and select the target table as table to append to.
    The name of the AutoNumber field should be entered automatically in the Append To row.
    Select Query | Run or click the Run button on the toolbar.
    Close the query (you don't have to save it unless you want to repeat it later)
    You can also delete the temporary table unless you want to reuse it.
    Open the target table and delete the record with AutoNumber 9999.

    Note: you should not compact the database before a new record has been added to the target table. If you do, the AutoNumber field may be reset to start at 1 again.

  3. #3
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: autono (2k)

    I try with ur explan but faild . i attach a fie that i do .
    Ashraf

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: autono (2k)

    The field ContractID1 in TblTarget is a number type. Change it to AutoNumber.
    Francois

  5. #5
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: autono (2k)

    That Is right but if i delete any record for ex 10004 I can not put it again .
    Ashraf

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: autono (2k)

    That is the way an AutoNumber field works. Once a number has been assigned, it will not be reused. The only exception is that compacting a database will make the AutoNumber continue at the highest existing number plus 1, and even that does not always work in recent versions of the Jet engine. AutoNumber will never fill in the gaps between existing numbers.

    AutoNumber fields are intended to provide a unique, but essentially meaningless ID number for records. If you have special requirements for numbering the records, you should not use an AutoNumber field, but write code to handle the numbering yourself. That can be a lot of work, but you will have complete control over how the numbers are assigned.

Posting Permissions

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