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

InStr function?

Status
Not open for further replies.

shanedavid1981

Programmer
Feb 3, 2005
54
US
Hi guys,

I'm trying to turn a name around in a query from Lastname,Firstname to Firstname Lastname...

I've toyed with the InStr function to do this, but it somehow garbles up my output from time to time...

this is the code that I used:

FName: (Right$([Name],InStr([Name],","))) & " " & (Left$([Name],InStr(1,[Name],",")-1))

i'm not quite sure where this could go wrong... so any insight would be very much appreciated...

Thanks!
 
Hi,

Try this:

FulllName: Right([Name],(Len([Name])-InStr([Name],","))) & " " & Left([Name],(InStr(1,[Name],",")-1))

 
You may try something like this:
FName: IIf(InStr([Name],',')>0, Mid([Name],InStr([Name],',')+1) & ' ' & Left([Name],InStr([Name],',')-1), [Name])

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

Part and Inventory Search

Sponsor

Back
Top