Hey there,
I am trying to make a unique ID for each of my records. So in my "First Name" and "Last Name" fields, I am trying to ADD ALL of the characters' ASCII code in both fields. AN e.g

First Name : JOHN (string)
Last Name : DOE(string)

Member ID should be : (Ascii of J) + (Ascii of O) + (Ascii of H) and so on till (Ascii of E) (in Last Name).

The problem with this is that the asc(string) command, returns the value of only the 1st letter in the string.
Any ideas?


8 Years
Discussion Span
Last Post by selvaganapathy

Dear Breezyy

The Asc() function returns the ascii value of only one character at a time. If u want to get the ascii values of a group of characters, u have to use the Asc() for each character one at a time. U can use For...Next to loop thru the characters of the string.

Dim xStr as String
Dim iVar as Integer
Dim tStr as Long

tStr =0
xStr = "Mark"

For iVar = 1 to Len(xStr)

    tStr = tStr + Asc(Mid(xStr,iVar,1)

Next iVar

But i dont get the point in saving ascii codes in the DB. if u join all the asc code of a string, how would u create an Unique ID. For eg if ABCD will result in 65+66+67+68=266 then XZX also results in 88+90+88=266. The how can there be uniqueness? I am actually not sure whether i have understood ur concept or not, but that is the doubt i had. Any How all the best dear. hope it solves ur problem

Shaik Akthar


I am trying to make a unique ID for each of my records.

Yes I agree Addition of Ascii dont give a unique number as Shaik Akthar. Better to use Auto Number or Other Algorithm.

Addition of Ascii of ABCD is same as Addition of Ascii of ABDC, BACD, and all its combination.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.