Connecting Tech Pros Worldwide Help | Site Map

Need to change LASTNAME, FIRSTNAME MI to FirstName M. LastName

musicloverlch
Guest
 
Posts: n/a
#1: Nov 13 '05
I used to have a function that would change data that came across as
LASTNAME, FIRSTNAME MI to FirstName M. LastName with an update query.
Does that sould familar to anyone?

Thanks in advance,
Laura

pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Need to change LASTNAME, FIRSTNAME MI to FirstName M. LastName



musicloverlch wrote:[color=blue]
> I used to have a function that would change data that came across as
> LASTNAME, FIRSTNAME MI to FirstName M. LastName with an update query.
> Does that sould familar to anyone?
>
> Thanks in advance,
> Laura[/color]

Use InStr to find the position of the comma, and then just grab all the
stuff to the left and right of it.
Something along the lines of

1. Find position if comma INSTR(1,",",MyString)
2. Take everything to the left: LEFT$(MyString, INSTR(1,",",MyString)))
3. Take everything to the right: RIGHT$(MyString,
Len(MyString)-INSTR(1,",",MyString)))

Probably not exactly right, but it should get you going in the right
direction.

musicloverlch
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Need to change LASTNAME, FIRSTNAME MI to FirstName M. LastName


Thanks so much. Just in case anyone was wondering, this is my formula:

StrConv(Right$([Name],Len([Name])-InStr(1,[Name],",")-1) & " " &
Left$([Name],InStr(1,[Name],",")-1),3)

Closed Thread