Control Source Problem: Last and First Names

Timberwolf

Registered User.
Local time
Today, 11:50
Joined
Dec 15, 2000
Messages
33
In a report I have created a text box in which I'd like the last and first name fields to appear:

=[LastName]+", "+[FirstName]

It works great, unless there is no data in the FirstName field, in which case the report shows no name at all. (A few of our clients are companies, not individuals.)

How can I get the Last Name to show up if there is no First Name?

Thanks.
 
Try
=IIF(IsNull([First Name]),[Last Name],[Last Name] & ", " & [First Name])
 
Hi Timberwolf

Keith's should work, but here's an alternative.

=[LastName]&(", "+[FirstName])

If my memory serves me right the ampersand - & - only links if the following field has data. The comma and space are therefore attached to the FirstName - only appearing when it does - and the concatenating operator here is the plus sign +.

HTH


Rich Gorvin
 
Take the time to look up the + and & signs in help. The entries explain how each works as a concatination operator. The & is the standard concatination operator and the + is normally an arithmatic operator. But in certain cases the + can be used as a concatination operator and as Rich@ITTC has pointed out, you may in certain circumstances get different results.
 
Thanks for the help, guys. Rich, your suggestion worked beautifully.

Pat, I'm definitely going to do as you suggest.

[This message has been edited by Timberwolf (edited 03-23-2001).]
 
Hi Timberwolf

Please to read that it did the trick.

Rich Gorvin

[This message has been edited by Rich@ITTC (edited 03-23-2001).]
 

Users who are viewing this thread

Back
Top Bottom