string expressions with null values

S

Stacey

How do I string these together?
=IIf(IsNull([ParentsFirstNameDad]),[ParentsFirstNameMom],[ParentsFirstNameMom] & " & " & [ParentsFirstNameDad])

and

=IIf(IsNull([HomeAddress]),"",[HomeAddress] & ", " & [Zip])
 
D

Douglas J. Steele

String together how?

Actually, for your first one, you can take advantage of the fact that + and
& have different behaviours when dealing with Nulls. Null + something
results in Null, while Null & something results in something. That means you
can use

ParentsFirstNameMom] & (" & " + [ParentsFirstNameDad]))

How do you want to string them together after that? Do you want the home
address to be on a separate line?

ParentsFirstNameMom] & (" & " + [ParentsFirstNameDad])) & (vbCrLf +
[HomeAddress] + ", " + [Zip])
 
S

Stacey

very cool!

Douglas J. Steele said:
String together how?

Actually, for your first one, you can take advantage of the fact that + and
& have different behaviours when dealing with Nulls. Null + something
results in Null, while Null & something results in something. That means you
can use

ParentsFirstNameMom] & (" & " + [ParentsFirstNameDad]))

How do you want to string them together after that? Do you want the home
address to be on a separate line?

ParentsFirstNameMom] & (" & " + [ParentsFirstNameDad])) & (vbCrLf +
[HomeAddress] + ", " + [Zip])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Stacey said:
How do I string these together?
=IIf(IsNull([ParentsFirstNameDad]),[ParentsFirstNameMom],[ParentsFirstNameMom]
& " & " & [ParentsFirstNameDad])

and

=IIf(IsNull([HomeAddress]),"",[HomeAddress] & ", " & [Zip])
 
Top