Trim Function?

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
 
F

Fredg

AfterCommaName:Mid([FullName],InStr([FullName],",")+2)
BeforeCommaName:Left([FullName],InStr([FullName],",")-1)
 
M

Martin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top