Return First character of First and last name

G

Guest

I have a field called Patient_Name that store the first and last name of
patient. I am creating a report that need to extract the 1st character of
first name and 1st character of last name into 2 columns. ex John,Smith
should pull as J in first column and S in the second column.
Thanks in advance...
 
K

Ken Snell [MVP]

This is one reason why you store the names in separate fields.

In your query, use a calculated field similar to this:

FLName: Left([Patient_Name], 1) & Mid([Patient_Name], InStr([Patient_Name],
",") + 1)
 
R

Rick B

Your database structure is flawed. You should have two separate fields
(firstname and lastname).

You could then do something like...

= Left([FirstName],1) & Left([LastName],1)



You can still accomplish this by using a much more complex string that looks
for spaces in the name, but what happens with Billy Bob Thornton? BB?


Rick B
 
J

John Vinson

I have a field called Patient_Name that store the first and last name of
patient. I am creating a report that need to extract the 1st character of
first name and 1st character of last name into 2 columns. ex John,Smith
should pull as J in first column and S in the second column.
Thanks in advance...

In addition to the concerns from the other posters... is it
satisfactory that John Smith, Jane Seymour, Janet Schultz and Jose
Sandoval all go into the field as JS? What is this initials field
being used for?

John W. Vinson[MVP]
 
K

Ken Snell [MVP]

Sorry... I was getting the entire last name.

FLInitials: Left([Patient_Name], 1) & Mid([Patient_Name],
InStr([Patient_Name],
",") + 1, 1)
--

Ken Snell
<MS ACCESS MVP>

Ken Snell said:
This is one reason why you store the names in separate fields.

In your query, use a calculated field similar to this:

FLName: Left([Patient_Name], 1) & Mid([Patient_Name],
InStr([Patient_Name], ",") + 1)

--

Ken Snell
<MS ACCESS MVP>

shaj said:
I have a field called Patient_Name that store the first and last name of
patient. I am creating a report that need to extract the 1st character of
first name and 1st character of last name into 2 columns. ex John,Smith
should pull as J in first column and S in the second column.
Thanks in advance...
 
G

Guest

Thanks Ken,
It works great !!!

Ken Snell said:
Sorry... I was getting the entire last name.

FLInitials: Left([Patient_Name], 1) & Mid([Patient_Name],
InStr([Patient_Name],
",") + 1, 1)
--

Ken Snell
<MS ACCESS MVP>

Ken Snell said:
This is one reason why you store the names in separate fields.

In your query, use a calculated field similar to this:

FLName: Left([Patient_Name], 1) & Mid([Patient_Name],
InStr([Patient_Name], ",") + 1)

--

Ken Snell
<MS ACCESS MVP>

shaj said:
I have a field called Patient_Name that store the first and last name of
patient. I am creating a report that need to extract the 1st character of
first name and 1st character of last name into 2 columns. ex John,Smith
should pull as J in first column and S in the second column.
Thanks in advance...
 

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