proper name conversion

H

Howard

I have a database that has names of people in one field,
in a last name, first name order. (example: Smith, John)
How can i seperate the last and first names from one text
field into two different fields? Or at least have only
the last name. thanks for any help.
 
R

Ronald W. Roberts

Howard said:
I have a database that has names of people in one field,
in a last name, first name order. (example: Smith, John)
How can i seperate the last and first names from one text
field into two different fields? Or at least have only
the last name. thanks for any help.
This is air code. It is looking for a space between the last name and
the first name.

Dim x As Integer
Dim fName As String
Dim LName As String
x = InStr(1, rs!Name, " ")
fName = Right(rs!Name, Len(rs!Name) - x + 1)
LName = Left(rs!Name, x - 1)

If you were looking for the comma then it would look like this.

Dim x As Integer
Dim fName As String
Dim LName As String
x = InStr(1, rs!Name, ", ")
fName = Right(rs!Name, Len(rs!Name) - (x + 2))
LName = Left(rs!Name, x - 1)

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top