Firstname Lastname - Lastname, Firstname

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Hello!
I inherited a database in Access 2000 with the employee
names listed as Firstname Lastname. Is there an easy way
to convert that data to Lastname, Firstname.

Ie: Change Gary Weiss to Weiss, Gary.

Thanks in advance!
Gary
 
Create two new fields [EmpFirstName] and [EmpLastName]. Then run an update
query that updates these fields with expressions using Instr(), Mid(),
Left() etc. This will allow you to display the names any way that you want.

There are some possible issues if your records contain middle initials,
salutations, etc. in the full name field.
 
Hello!
I inherited a database in Access 2000 with the employee
names listed as Firstname Lastname. Is there an easy way
to convert that data to Lastname, Firstname.

Ie: Change Gary Weiss to Weiss, Gary.

Thanks in advance!
Gary

This is why most developers will have separate fields for first and
last names: it's much easier to concatenate two fields than to
separate a single field, and it makes it much easier to (say)
alphabetize a list by last name. Some of the problems you'll
encounter:

Joe Bob Smith ' what's his first name? Everyone calls him Joe Bob
Mark van Kleef ' but he's Mark, last name van Kleef

That said - you can get the simple two-name cases turned around using
Access' string functions:

TurnedName: Trim(Mid([EmpName], InStr([EmpName], " "))) & ", " &
Left([EmpName], InStr([EmpName], " "))

You can (and probably should!) add new FirstName and LastName fields
to your table; run an Update query updating FirstName to

Left([EmpName], InStr([EmpName], " ") - 1)

and LastName to

Trim(Mid([EmpName], InStr([EmpName], " ")))

and then fix up the Joe Bob and other special cases.
 
-----Original Message-----
Hello!
I inherited a database in Access 2000 with the employee
names listed as Firstname Lastname. Is there an easy way
to convert that data to Lastname, Firstname.

Ie: Change Gary Weiss to Weiss, Gary.

Thanks in advance!
Gary
.

Here's how you convert from first name and last.

1)Go to you Query Database with the firstname and lastname
information.

2)Open in Design View

3)On "Field:" type in Name:[Lastname] & "," & [Firstname]

4)This will change name from Gary Weiss to Weiss, Gary

Sai Scott Vy
 
Back
Top