Results 1 to 3 of 3
  1. #1
    ridgeandgable is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2017
    Posts
    3

    Random Number

    Hi Lads,



    How can I add a unique random number as a customer ID? I would like it to be the First initials of the CustomerName and a 4 digit number? So for myself it would be HL1234 (Harry Lodge)

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Easiest would be to use an autonumber field as the key, and concatenate the initials to it when displaying to the user.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    I notice you didn't start with 1. The answer is a good one, but I'm guessing you won't be happy with H1 for you and M2 for me. You might want to seed the autonumber start, or post back if you had a specific "format" in mind, such as leading zeros or always 4 digits or whatever.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 5
    Last Post: 03-31-2016, 07:59 AM
  2. random number generator
    By scottdg in forum Programming
    Replies: 22
    Last Post: 05-12-2015, 01:36 PM
  3. Random Number
    By MTSPEER in forum Queries
    Replies: 3
    Last Post: 04-14-2015, 11:37 AM
  4. Random Number and Comparison
    By Azgambit in forum Programming
    Replies: 1
    Last Post: 10-22-2013, 04:55 PM
  5. No-So-Random Number
    By oleBucky in forum Programming
    Replies: 8
    Last Post: 11-08-2011, 11:02 AM

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