Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2015
    Posts
    1

    Unanswered: Random Number Assign

    Hello,

    I need to assign a random ID number between 1 and 500. I already am using the Auto number in the table for something else. So in the form I would like this field to generate a random number between 1 and 500 once data is going to be entered just like the auto number feature.

    Please help thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you could set the value fo the column using the rnd function in the forms before insert code block
    ... but you'd need to do soem more work to make certain that the proposed value had not already been issued (hint set a unique index constraint on the column.

    OR use a numbers table (containing just a column with the numbers 1 to 500 in
    use a left join from the numbers table to the other table... setting a where clause to the main table = n ull will give a list of available (unused) numbers. select top 1 with an order of RAND shousdl do the job


    bu8t it does beg the question what makes you want to store a random number for 500 rows.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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