Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Needing an if statement in addition to adding two fields together

Status
Not open for further replies.

mneumann25

Technical User
Jul 30, 2003
3
US
Hi,
I am trying to come up with a way to have two fields seperated by a comma on a report. Normally, I would just use
=[Last Name] & ", " & [First Name]
However, there will not always be a first name, in which case I want the report to just display the last name without a comma behind it...any suggestions on how to do this???

Thanks!
 
Try setting the control source to something like this:
Code:
=IIf(First Name] Is Null,[Last Name],[Last Name] & ", " & [First Name])




A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
Douglas Adams
 
Replace the second "&" with "+".
=[Last Name] & ", " + [First Name]
If First Name is null then ", " also becomes Null.

"abc" & Null = "abc"
"abc" + Null = Null

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top