How Do I Change Name Fields to Initials for Reports

S

Sgt Gordon

I have the following fields in my Database:
First Name
Last Name
Middle Initial

On my Report I am trying to get it so that it is Last Name, and then
Initials.

Does MS Access have a way of pulling the first letter of a field to create
initials?
 
J

Jerry Whittle

Sure thing Sarge. (I hated when people called me that. Bet that it beats
"Flash" though!)
The left function would do it.

[Last Name] & " " & Left([First Name],1) & Left([Middle Initial],1)

Remove the " " & if you don't want a space between the last name and initials.
 
S

Sgt Gordon

Thank you that was a Big Help

Jerry Whittle said:
Sure thing Sarge. (I hated when people called me that. Bet that it beats
"Flash" though!)
The left function would do it.

[Last Name] & " " & Left([First Name],1) & Left([Middle Initial],1)

Remove the " " & if you don't want a space between the last name and initials.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Sgt Gordon said:
I have the following fields in my Database:
First Name
Last Name
Middle Initial

On my Report I am trying to get it so that it is Last Name, and then
Initials.

Does MS Access have a way of pulling the first letter of a field to create
initials?
 
K

Ken Sheridan

The Left function can be used here. You could base the report on a query
with a computed column. To do this put the following in the 'field' row of a
blank column in the query design grid:

FullName: [Last Name] & " " & Left([First Name],1) & " " & [Middle Initial]

Alternatively you can do it in the report with a computed text box control
with a ControlSource property of:

=[LastN ame] & " " & Left([First Name],1) & " " & [Middle Initial]

Incidentally, if you ever need to do it with the name and/or initials first,
and you have some names where the middle initial is missing, you'd use a
slightly different method, e.g. for the name in full:

=[First Name] & " " & ([Middle Initial] + " ") & [LastName]

Because Null + anything = Null this will suppress the unwanted second space
if the Middle Initial field is Null. The parentheses force the expression
within them to evaluate independently. If you were to concatenate the second
space with a Null Middle Initial using the ampersand concatenation operator,
however, you'd end up with two spaces before the first and last names.

Ken Sheridan
Stafford, England
 

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