Introducing a condition into an expression

  • Thread starter Thread starter Winefride
  • Start date Start date
W

Winefride

I have an expression eg Expr1: [Donor1First Name] & " and " &
[Donor2FirstName]
I dont want the word "and" to appear if [Donor2FirstName] is null.
Any ideas?
Thanks in advance for any help.
 
Expr1: [Donor1First Name] & IIf(IsNull([Donor2FirstName]),""," and " &
[Donor2FirstName])
 
I have an expression eg Expr1: [Donor1First Name] & " and " &
[Donor2FirstName]
I dont want the word "and" to appear if [Donor2FirstName] is null.
Any ideas?
Thanks in advance for any help.

There are a couple of ways.
1)
Expr1:IIf(IsNull([Donor2FirstName]),[Donor1firstName],
[Donor1FirstName] & " and " & [Donor2FirstName])

or you could use:

Expr1:[Donor1FirstName] & (" and " + [donor2FirstName])
 
Thank you very much.
--
Winefride


Klatuu said:
Expr1: [Donor1First Name] & IIf(IsNull([Donor2FirstName]),""," and " &
[Donor2FirstName])
--
Dave Hargis, Microsoft Access MVP


Winefride said:
I have an expression eg Expr1: [Donor1First Name] & " and " &
[Donor2FirstName]
I dont want the word "and" to appear if [Donor2FirstName] is null.
Any ideas?
Thanks in advance for any help.
 
Thank you very much.
--
Winefride


fredg said:
I have an expression eg Expr1: [Donor1First Name] & " and " &
[Donor2FirstName]
I dont want the word "and" to appear if [Donor2FirstName] is null.
Any ideas?
Thanks in advance for any help.

There are a couple of ways.
1)
Expr1:IIf(IsNull([Donor2FirstName]),[Donor1firstName],
[Donor1FirstName] & " and " & [Donor2FirstName])

or you could use:

Expr1:[Donor1FirstName] & (" and " + [donor2FirstName])
 
Back
Top