Trim Function?

  • Thread starter Thread starter JC
  • Start date Start date
J

JC

Hi--is there a way in Access to do a formula that will
trim off a person's name, and only show up what's after
or before the comma? For example: Smith, John --and I
only want John to come back or I only want Smith to come
back. Are there any functions to accomplish this?

Thanks!

JC
 
AfterCommaName:Mid([FullName],InStr([FullName],",")+2)
BeforeCommaName:Left([FullName],InStr([FullName],",")-1)
 
Here is simplest code I could think of...

Dim a As String, b As String
a = "Johnson, Magic"
b = Left$(a, InStr(1, a, ",") - 1) 'first name
b = Mid$(a, InStr(1, a, ",") + 1) 'last name

Martin
 
Back
Top