How do you join LastNanes & FirstNames in a Access Report

  • Thread starter Thread starter sharpe
  • Start date Start date
S

sharpe

When you have a list of Fields taken from a table like [FirstName],
[LastName],
[OrderID], [SalesAmount]

And you want to combine the First and Last Name together.

So it shows like this on the report:

Name

Joe, Smith


And not like this:

First Name Last Name

Joe Smith

I am using Windows XP With Access 2002

Regards

David
 
Create a Text Box on the report and set it's data source to =[FIRSTNAME] & "
" & [LASTNAME] - the quotes with a space betwenn create the space between the
first and last name

Sheila
 
Add an unbound text box to your report and put the following in it...

=[LastName] & ", " & [FirstName]
 
If you want to get really fancy (should you have a field that holds a middle
initial) use this code:

=[surname]& " " & [first] & iif([mi]<>"", " " & [mi] & ".", "")

This looks to see if there is a middle initial, if so, it shows it and
places a period; if not, it shows nothing

The end result will be this:
Smith, Joe B.
Jones, Bill


And the other way:
=[first] & iif([mi]<>"", " "&[mi]&". "&[surname], " "&[surname])

The output will be this:
Joe B. Smith
Bill Jones
 
I could be wrong, but I think putting ....


[mi]+"."



Will do the smae thing, but with less code. I believe the "+" will only
produce a result if both fields contain an entry.
 
Back
Top