ID Field with random numbers

coolcatkelso

Registered User.
Local time
Today, 08:13
Joined
Jan 5, 2009
Messages
279
Hiya Guys

I'm looking to build a basic table that spits out an ID that I can use in SAGE Accounts for my customer ID

I want something like:

First Name:
Last Name:
CustomerID: (First Letter from First Name)&(First Letter from Last Name)&(random Number)

Sage only allows for 8 spaces

so example of me would be

First Name: Harry
Last Name: Lodge
CustomerID: HL123456

Is that possible, and if so, how :D

Cheers
 
I would just use an Autonumber for the Customer ID and then whenever you need to display an ID, you build it per your instructions. The data would be this:

First Name (text): Harry
Last Name (text): Lodge
CustomerID (autonumber): 7

Then when you display it you can create it like this:

Mid([First Name], 1,1) & Mid([Last Name] , 1,1) & Format([CustomerId],"000000")

That would spit out "HL000007". This way the number is always unique, which is more important than random.
 

Users who are viewing this thread

Back
Top Bottom