Putting text in parentheses

G

Guest

I currently have a field on a report that shows LastName, Suffix, FirstName
MI. It is set up as follows: =Trim([LastName] & (", "+[Suffix]) & ", " &
[FirstName] & (" "+[MI]))

This shows the name and if there is no suffix or middle initial it doesn't
show the field of the commas. I want to add a field called [Alias] this
holds the persons Nickname or what they prefer to be called. I want to add
to the report this field in parentheses and if it is empty not show the
parentheses or the field.

Currently the best I have been able to do is the following:

=Trim([LastName] & (", "+[Suffix]) & ", " & [FirstName] & (" "+[MI] & "
" & IIf(IsNull([Alias]),"",[Alias] & " ")))

But this returns the LastName, Suffix, Firstname MI Alias
which looks like this - Doe, Sr., John Jack

I read somewhere about using &Format, cut couldn't figure out how to put it
in the code properly.

I am a Novice at this
 
J

John Spencer

Try the following

=Trim([LastName] & (", "+[Suffix]) & ", " &
[FirstName] & (" "+[MI]) & ( "(" + [Alias] + ")") )

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
G

Guest

That worked!!! I just had to add a few spaces so that it didn't look like
Margaret(Peg), but looked like Margaret (Peg)

Thanks
--
cao


John Spencer said:
Try the following

=Trim([LastName] & (", "+[Suffix]) & ", " &
[FirstName] & (" "+[MI]) & ( "(" + [Alias] + ")") )

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

srctr said:
I currently have a field on a report that shows LastName, Suffix, FirstName
MI. It is set up as follows: =Trim([LastName] & (", "+[Suffix]) & ", "
&
[FirstName] & (" "+[MI]))

This shows the name and if there is no suffix or middle initial it doesn't
show the field of the commas. I want to add a field called [Alias] this
holds the persons Nickname or what they prefer to be called. I want to
add
to the report this field in parentheses and if it is empty not show the
parentheses or the field.

Currently the best I have been able to do is the following:

=Trim([LastName] & (", "+[Suffix]) & ", " & [FirstName] & (" "+[MI] & "
" & IIf(IsNull([Alias]),"",[Alias] & " ")))

But this returns the LastName, Suffix, Firstname MI Alias
which looks like this - Doe, Sr., John Jack

I read somewhere about using &Format, cut couldn't figure out how to put
it
in the code properly.

I am a Novice at this
 

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