Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2012
    Posts
    27

    Unanswered: Create a number based on a name

    Hello everyone,

    I have a question regarding how to create a 'unique' number based on a name.
    I want to create a unique identifier for customers to start a points reward program.
    I am going to combine the primary key for each customer and combine their name to get that unique number.
    I would like to know if there is a way to convert the name into a number based on their character positions in the alphabet. IE: Bob would be 2152.

    Is something like this possible? If not, is there a way to generate a random number in access? 10 characters?

    Hopefully I have explained this well enough.
    Any thoughts or suggestions would be appreciated.

    Using Access 2010.

    Have a great day!
    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Yes its posssible however it would be tough to get a unique number from just a name, whether thats bob or bob jones. Wgat you could do is use, say the given name and add a suffix in much the same style ad your userid
    say you use 5 letters of the family (surname) and 4 digits
    Bob smith might be smith0045
    emily smithson might be smith0666

    to do that youd need a function that returned the new number
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Nov 2010
    Posts
    84
    Manage information about business partner is a very important business process in every company. It is very likely that you have a case that will appear in two physically different business partners and to have the same name. It would therefore be much better to identify business partners to some of the most unique (identity) attributes (eg. Registration number, the driver's license number, Social Security Number, tax number or email).
    And when recording new to the selected attribute checks that already exists in the database or not.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You are looking for a Hash Function. Perfect Hash Functions have been one of the "holy grails" of computing for over fifty years, but you can often create one that is good enough for a specific purpose.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  5. #5
    Join Date
    Apr 2012
    Posts
    27
    Thanks guys, I appreciate the responses.

    I am able to make each one unique by using the autonumber that is created for each customer. I will combine the autonumber andthen the name after it is converted. There can be 10 Bob Smiths and each one would still have a unique ID based on the first field that I created.
    What I need is to be able to convert the name to a number field. I don't want a mixture of letters and numbers, just all numbers so I can create a barcode to scan.

    The name is the only way I thought of taking information that is given by the customer without having to create it myself.
    ID's (DL, SIN#'s etc are tricky due to Privacy Act)
    Customers are not required to provide a phone number (and not everyone has one)

    Any other thoughts??

    Thanks again!

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Just use the autonumber???

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    https://www.google.co.uk/search?redi...=1408465563696
    Depending on the barcode chosen you can use alphanumerics in a barcode
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can always use a function that will return a meaningless number computed from the ANSI code of each letter in the name. e.g.
    Code:
    Public Function NameToNumber(ByVal Name As String) As Long
    
        Dim i As Long
        Dim str As String
        
        For i = 1 To Len(Name)
            NameToNumber = NameToNumber + Asc(Mid(Name, i, 1))
        Next i
        
    End Function
    Have a nice day!

  9. #9
    Join Date
    Apr 2012
    Posts
    27
    Hi folks, sorry for the late responses. Haven't been on since August.

    I appreciate everyone's help and have tried multiple suggestions and picked one that suited me.

    Thanks again for your help.

Posting Permissions

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