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

Extracting First Name from Full Name Field in Access 2000 1

Status
Not open for further replies.

jimdevon

IS-IT--Management
Oct 14, 2002
25
US
I have read some answers for the split function, but do not understand. I need to take the first and last names from a full name field to create two separate fields. I have two empty fields in the table which I wish to fill. Thanks in advance. Jimdevon
 
What does your name field consist of. For example, is it first name, comma, lastname, comma, title? Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
I suppose your full name field is built like "Firstname Initials Lastname". And the field is named txtName. The first name comes into the field txtFname, lastname in txtLname.

Dim Lname As String
Dim Fname As String
Dim length As Integer
Dim occ1 As Integer
Dim occ2 As Integer
Dim str As String

length = Len(txtName)
occ1 = InStr(txtName, " ")
Fname = Left(txtName, occ1)
txtFname = Fname
str = Right(txtName, length - occ1)
occ2 = InStr(str, " ")
length = Len(str)
Lname = Right(str, length - occ2)
txtLname = Lname


Kind regards
Borg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top