Adding a automatic user id

  • Thread starter Thread starter Emma
  • Start date Start date
E

Emma

Hi I have a database which requires the user to enter the client id which
right now is first three letters of first name followed by first three
letters of last name. How can I code something similiar so that the user name
comes up automatically I don't really care if it uses first and last name but
it would be nice. Thanks Emma
 
Emma

Your current approach is fraught with danger!

What happens if the following two clients sign up?

Smithfield, Thomas
Smith, Thomasina

If, instead of trying to use their names, you set up a table that uses an
autonumber for the primary key/ID field, then added fields for FName and
LName and DOB and ..., you'd have a way to let your users PICK the correct
client from a combobox.

You'd 'feed' that combobox with a query.

(HINT: even FName/LName/DOB is insufficient to uniquely identify persons --
a fellow at my work shared his name and DOB with someone else who lived
within 100 miles ... and had to prove to the police that he wasn't THAT
other fellow!)

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
That's good to know I'll take the date of nirth into consideration, but I'm
not sure how to get the year?

Here's what I have so far

Private Sub Last_Name_AfterUpdate()
[Client ID] = Left([Last Name],3)
End Sub

Private Sub First_Name_AfterUpdate()
[Client ID] = [Client ID] + Left([First Name], 3)
End Sub
 
My suggestion was to NOT use the name, as more than one person can have the
same/similar name.

Rather than trying to stuff multiple pieces (i.e., "facts") into a single
field (not good database design), consider using an Access Autonumber field
to provide a unique (but meaningless) row identifier.

You can get the "year" of the DOB by using a query and something like:

BirthYear: Year([DOB])

Regards

Jeff Boyce
Microsoft Office/Access MVP

Emma said:
That's good to know I'll take the date of nirth into consideration, but
I'm
not sure how to get the year?

Here's what I have so far

Private Sub Last_Name_AfterUpdate()
[Client ID] = Left([Last Name],3)
End Sub

Private Sub First_Name_AfterUpdate()
[Client ID] = [Client ID] + Left([First Name], 3)
End Sub

Jeff Boyce said:
Emma

Your current approach is fraught with danger!

What happens if the following two clients sign up?

Smithfield, Thomas
Smith, Thomasina

If, instead of trying to use their names, you set up a table that uses an
autonumber for the primary key/ID field, then added fields for FName and
LName and DOB and ..., you'd have a way to let your users PICK the
correct
client from a combobox.

You'd 'feed' that combobox with a query.

(HINT: even FName/LName/DOB is insufficient to uniquely identify
persons --
a fellow at my work shared his name and DOB with someone else who lived
within 100 miles ... and had to prove to the police that he wasn't THAT
other fellow!)

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Thanks so I just make the client ID an autonumber?

Jeff Boyce said:
My suggestion was to NOT use the name, as more than one person can have the
same/similar name.

Rather than trying to stuff multiple pieces (i.e., "facts") into a single
field (not good database design), consider using an Access Autonumber field
to provide a unique (but meaningless) row identifier.

You can get the "year" of the DOB by using a query and something like:

BirthYear: Year([DOB])

Regards

Jeff Boyce
Microsoft Office/Access MVP

Emma said:
That's good to know I'll take the date of nirth into consideration, but
I'm
not sure how to get the year?

Here's what I have so far

Private Sub Last_Name_AfterUpdate()
[Client ID] = Left([Last Name],3)
End Sub

Private Sub First_Name_AfterUpdate()
[Client ID] = [Client ID] + Left([First Name], 3)
End Sub

Jeff Boyce said:
Emma

Your current approach is fraught with danger!

What happens if the following two clients sign up?

Smithfield, Thomas
Smith, Thomasina

If, instead of trying to use their names, you set up a table that uses an
autonumber for the primary key/ID field, then added fields for FName and
LName and DOB and ..., you'd have a way to let your users PICK the
correct
client from a combobox.

You'd 'feed' that combobox with a query.

(HINT: even FName/LName/DOB is insufficient to uniquely identify
persons --
a fellow at my work shared his name and DOB with someone else who lived
within 100 miles ... and had to prove to the police that he wasn't THAT
other fellow!)

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP


Hi I have a database which requires the user to enter the client id
which
right now is first three letters of first name followed by first three
letters of last name. How can I code something similiar so that the
user
name
comes up automatically I don't really care if it uses first and last
name
but
it would be nice. Thanks Emma
 
Yes. Then use a query to display the names for use in a combobox. That way
the user can "pick" the person rather than try to remember the proper 'code'
for them.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Emma said:
Thanks so I just make the client ID an autonumber?

Jeff Boyce said:
My suggestion was to NOT use the name, as more than one person can have
the
same/similar name.

Rather than trying to stuff multiple pieces (i.e., "facts") into a single
field (not good database design), consider using an Access Autonumber
field
to provide a unique (but meaningless) row identifier.

You can get the "year" of the DOB by using a query and something like:

BirthYear: Year([DOB])

Regards

Jeff Boyce
Microsoft Office/Access MVP

Emma said:
That's good to know I'll take the date of nirth into consideration, but
I'm
not sure how to get the year?

Here's what I have so far

Private Sub Last_Name_AfterUpdate()
[Client ID] = Left([Last Name],3)
End Sub

Private Sub First_Name_AfterUpdate()
[Client ID] = [Client ID] + Left([First Name], 3)
End Sub

:

Emma

Your current approach is fraught with danger!

What happens if the following two clients sign up?

Smithfield, Thomas
Smith, Thomasina

If, instead of trying to use their names, you set up a table that uses
an
autonumber for the primary key/ID field, then added fields for FName
and
LName and DOB and ..., you'd have a way to let your users PICK the
correct
client from a combobox.

You'd 'feed' that combobox with a query.

(HINT: even FName/LName/DOB is insufficient to uniquely identify
persons --
a fellow at my work shared his name and DOB with someone else who
lived
within 100 miles ... and had to prove to the police that he wasn't
THAT
other fellow!)

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP


Hi I have a database which requires the user to enter the client id
which
right now is first three letters of first name followed by first
three
letters of last name. How can I code something similiar so that the
user
name
comes up automatically I don't really care if it uses first and last
name
but
it would be nice. Thanks Emma
 
Back
Top