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

Problem with imported data

Status
Not open for further replies.

cheyenne2002

Instructor
Jul 26, 2005
229
US
I have just imported a very large amount of data into a table. I have one problem. The contact name is formatted as Smith, John Andrew, giving the last name first followed by a comma then the first name and a middle if there is one.

Is there a simple way to get this into the correct format so I can use this for making mailing labels.

Thank you.

Sharon
 
into the correct format
And what is your correct format ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 



Hi,

It its ALWAYS last, first middle...

past this function into a MODULE
Code:
Function NameSplit(sName, sDelim, n)
    NameSplit = Split(sName, sDelim)(n)
End Function
In the Query editor enter the name as
[tt]
Expr1: NameSplit([Name],",",1) & " " & NameSplit([Name],",",0)
[/tt]


Skip,

[glasses] [red][/red]
[tongue]
 
You wanted something like this (SQL code) ?
UPDATE yourTable
SET ContactName = Trim(Mid(ContactName, 1+InStr(ContactName,','))) & ' ' & Left(ContactName, InStr(ContactName,',')-1)
WHERE ContactName Like '*,*'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top