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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Membership Number using first letter of surname. How?

Status
Not open for further replies.

Togora

Technical User
Aug 18, 2001
30
GB
I am setting up a very small database containing members details. What I would like to do is issue each member with a unique membership number in the format A001, where A = Surnames first letter eg A = Adams or S = Smith.

How is this possible in Access 97.

Regards

Togora

PS
 
Togora

Create a table for your member details and include these two fields
intIDgenerator (autonumber field) and txtMemberID (text field), make the txtMemberID your Key Field.

On the form where you enter the member details you need the following code on the AfterUpdate event for the txtsurname field

[txtMemberID] = left([txtsurname],1) & [intIDGenerator]

It's not perfect but it should work it should work.

Cheers

Chris
 
A convenient way to encode names (or any group of < ~ 30 characters) is the SOUNDEX function. It does NOT guarntee uniqueness, but for small groups, that may be done by just checking for a dup on initial entry/assignment and an adjustment (incr a char until the Soundex string is Unique).

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top