Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating Unique Customer Number 1

Status
Not open for further replies.

jcarmody

Programmer
Apr 25, 2002
39
0
0
US
I need to generate a unique customer number for our clients. (If someone has 3 records the customer number must be the same for all 3 records.) I have a table with all the basic customer information including Social Security number. Does anyone have some code that would encrypt the Social Security number the same way each time to generate a number I can use for my customer number?

Thanks -

Jcarmody
 
I don't know how to do a mathmatically formula. You may be better off just storing the SSN and an ID as autonumber in a table. Use the ID generated as your customer number and you can allways refer back to the primary key.

I am sure you database has some basic customer table. Make that another value in the table but make the primary key auto number. This would be a bit easier and allow for people who may not have an SSN... like people new to the US.
 
There would be a variety of ways to encrypt an alphanumeric string.

Simply try the Asc(), or Chr()

so maybe on the AfterInsert Event of form

Dim varSIN As Variant, varEncrypt As Variant

varSIN = DLookUp("txtSIN","tblCustomer","pkID = " & Me.ID)

For x = 1 To Len(varSin)

VarEncrypt = VarEncrypt & Chr(Mid(VarSin,x,1))
Next x

this will turn each number to it's corresponding ANSII character.

The encryption ideas are endless.
If you want to keep it numeric Then something like

VarEncrypt = VarEncrypt & (Mid(VarSin,x,1) * x)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top