Results 1 to 2 of 2
  1. #1
    shroomyszn is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2020
    Posts
    1

    Question How to assign Rnd function to a specific column in a table?

    Hello



    I'm using access to complete an accounting assignment and I'm having a terrible time with it. Hopefully someone can help

    I have a form in which one column is an autonumber called "Student ID". I would like this autonumber to display a random number between 10000000 and 99999999.

    I have used the Rnd function to create this random number generator but I have absolutely no idea how to assign it to my Student ID column?

    Thank you for the time, any help would be appreciated

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I presume this autonumber field is your primary key - in which case it should have no meaning other than as a unique identifier for a record. Autonumber fields cannot be changed once a value is set and it is set as soon as you create the record. Suggest leave the autonumber field alone and create another field for your student ID.

    With regards assigning your function value, this cannot be done at the table level, you will either need to use an append or update query or use code in a form before update event

    Edit: autonumber fields can be set to generate random numbers rather than incremental, but they will include negatives and cannot be limited to a range

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

Similar Threads

  1. Replies: 9
    Last Post: 08-11-2016, 11:30 AM
  2. Replies: 3
    Last Post: 04-25-2016, 04:23 AM
  3. Replies: 7
    Last Post: 02-20-2014, 02:34 PM
  4. How to assign a specific value to each record within a query
    By Access2007_NewUser in forum Access
    Replies: 1
    Last Post: 04-22-2012, 08:28 PM
  5. Replies: 15
    Last Post: 02-16-2010, 10:58 AM

Tags for this Thread

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