Formatting text in a report

MARYADVANCE

New member
Local time
Today, 21:23
Joined
Mar 2, 2000
Messages
5
I have a ODBC table that has customers in it. The name field is like this "Doe, John"
I want to know if there is a way I can put the first name "John" before the last name "Doe" when it is displayed on the report. Could I use the function =Left([Name],?) and some how make it select the text up until the comma and make that [Last Name] and then use =Right([Name],?) and select all text back to the comma and make that [First Name] and then combine the two field on my report. I think this could work but don't know how.
Please Help
Thank You
Mary
 
Mary
Your answer uses the InStr function which will return an integer representing the position of a sub-string within a string. Once you know this, you can use Left to pull out the number of characters up to the number you extracted with InStr. Once that is done you use Mid to extract the String you are after.

Have sent some example code. Look at frmSplitNames
Good Luck
Chris
 

Users who are viewing this thread

Back
Top Bottom