string expressions with null values

  • Thread starter Thread starter Stacey
  • Start date Start date
S

Stacey

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

and

=IIf(IsNull([HomeAddress]),"",[HomeAddress] & ", " & [Zip])
 
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])
 
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])
 

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

Back
Top