Question about autonumber

Results 1 to 2 of 2

Thread: Question about autonumber

  1. #1
    Reggie Guest

    Default Question about autonumber

    Is there a way to mimic an autonumber field without the possibility of creating a duplicate number? I want something like an autonumber, but I want to have control over what that number is (i.e. 1xxx if is it a project in one location and 2xxx if it is a project in another location). This is also assuming there is no way we will ever have more than a thousand projects in one location.<BR><BR>I&#039;ve read that locking the database would allow me to do this. Does anyone know of any other way? Thanks!

  2. #2
    Join Date
    Dec 1969

    Default No, it is best to...

    Lock the database<BR>select max(yourfield) from yourtable<BR>then<BR>insert into yourtable (yourfield) values (yourfield+1)<BR>then<BR>unlock the database<BR><BR>-- Whol

Posting Permissions

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