Newbies asmithusa Posted February 13, 2002 Newbies Posted February 13, 2002 Field is: LastN Suffix (e.g. Jr.), FirstN MiddleN (note comma between Suffix & FirstN The field's data may have only LastN and FirstN or any combination of the above (2 up to 4 words). e.g. Smith, Allen (2 names) or Smith Jr., Allen (3 names) or Smth, Allen Sterling (3 names) or Smith jr., Allen Sterling (4 names) The result needed for each field is - FirstN MiddleN (if any) LastN and Suffix (if any) in one field with out comma I have seen postings about saving a copy as global. Is this a file or field? And using the Position function. All in all I am totally confused. Any help would be appreciated.
danjacoby Posted February 13, 2002 Posted February 13, 2002 Assuming there's no comma between the LastN and the Suffix (as there theoretically should be), you can use the "Position" command to find the first word after the comma. Sorry, too tired right now to do the whole thing for you, but it's a start.
Fitch Posted February 15, 2002 Posted February 15, 2002 I'll be the Professor of Logic for today... Last Name = Left(Name, Position(Name, ",", 1, 1) - 1) Here the Position() function tells us what character number the comma is, and since we don't want the comma, we subtract one. The Left() function tells us to get that many characters. First Name = Right(Name, Length(Name) - Position(Name, ",", 1, 1)) Here we need to sort of flip the first function around, so we get the Length of the Name and subtract the function we used in the first step. so the Full Name = Right(Name, Length(Name) - Position(Name, ",", 1, 1)) & " " & Left(Name, Position(Name, ",", 1, 1) - 1) I know it's a bit of a mind-bender. Have some coffee and read the online help, it explains it better than I could.
Newbies asmithusa Posted February 15, 2002 Author Newbies Posted February 15, 2002 Thanks to both of you for the help. Dan got me started in the correct direction and Fitch gave me the "nuts and bolts". It is working beautifully.
danjacoby Posted February 16, 2002 Posted February 16, 2002 Not exactly Tinker to Evers to Chance, but then I was never a Cubs fan anyway.
Recommended Posts
This topic is 8387 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now