Results 1 to 4 of 4
  1. #1
    avarusbrightfyre is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Sep 2009
    Posts
    60

    Random ID Field

    I have a table whose ID field I want to be a random number, but it keeps posting negative numbers. Is there a way to force it to generate only positive integers?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    If it's a random number why do you care?
    You can use autonumber with a random option
    see http://en.wikipedia.org/wiki/AutoNumber

  3. #3
    avarusbrightfyre is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Sep 2009
    Posts
    60
    I care because I'm using the number as a customer number that will appear on paperwork, and it doesn't really make sense to have a negative customer number.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    I'd recommend you didn't do that. The autonumber field is intended for Access' use, not the user. An autonumber is essentially a unique number, but NOT NECESSARILY sequential. You could have a table for Customer numbers and assign them as you add Customers. Or you can pick a starting number, assign it to the Customer. Then next time,identify the largest Customer number in your Customer Table and increment that number and assign it to the next Customer etc. Of course you could use a custom algorithm to assign numbers, but you would have to ensure that the number to be assigned HAS NOT YET BEEN ASSIGNED. The id of the Customer record and your Customer Number are not necessarily the same field.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Random 0 now
    By Mounds in forum Access
    Replies: 4
    Last Post: 04-29-2011, 10:04 AM
  2. Random sampling
    By uscpa in forum Queries
    Replies: 4
    Last Post: 01-23-2010, 03:12 AM
  3. Random Rdn() Funtion Help Please
    By graviz in forum Access
    Replies: 1
    Last Post: 12-09-2009, 11:57 AM
  4. Random numbers
    By Gator777 in forum Access
    Replies: 3
    Last Post: 08-12-2009, 10:04 AM
  5. random record
    By wasim_sono in forum Programming
    Replies: 1
    Last Post: 02-06-2008, 02:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums