Left, LTrim, or what

G

Guest

I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry
 
D

Duane Hookom

Hopefully your field values are consistent.

Feel free to open a module and search Help on Left, Mid, Instr. You should
be able to figure out the syntax. If not, come back with "a field" name.
 
A

Allen Browne

Use:
- Instr() to locate the comma,
- Mid() to get the remainder of the field,
-Trim() to deal with the space.

So, assuming a field named FullName, the FirstName would be:
Trim(Mid([FullName], Instr([FullName], ",") + 1))
 
R

Randy Harris

JWCrosby said:
I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry

Perhaps:

Left([FullName], Instr([FullName], ",") + 2)
 
G

Guest

Yours did it, Randy. Thanks!

Jerry

Randy Harris said:
JWCrosby said:
I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry

Perhaps:

Left([FullName], Instr([FullName], ",") + 2)
 

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