Concatenation and IIf

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to concatenate the names into a string and what I'm trying to
achieve is this: txtfirstname + txtlastname, txtothername. But the problem is
that the comma shows up for those without the txtothername. So I tried with
this expression but there seems to be a problem:

[txtfirstname] & " " & [txtlastname] & IIf(IsNull[txtothername], " ", ", ")
& [txtothername]

Any idea what's wrong? Thanks.
ck
 
IsNull() is a function that requires ()s.
=[txtfirstname] & " " & [txtlastname] & IIf(IsNull([txtothername]), " ", ",
") & [txtothername]
You could also try:
=[txtfirstname] & " " & [txtlastname] & ", " + [txtothername]
 
Oops...somehow, I missed out the (). Thanks.
ck

Duane Hookom said:
IsNull() is a function that requires ()s.
=[txtfirstname] & " " & [txtlastname] & IIf(IsNull([txtothername]), " ", ",
") & [txtothername]
You could also try:
=[txtfirstname] & " " & [txtlastname] & ", " + [txtothername]

--
Duane Hookom
MS Access MVP


CK said:
I'm trying to concatenate the names into a string and what I'm trying to
achieve is this: txtfirstname + txtlastname, txtothername. But the problem
is
that the comma shows up for those without the txtothername. So I tried
with
this expression but there seems to be a problem:

[txtfirstname] & " " & [txtlastname] & IIf(IsNull[txtothername], " ", ",
")
& [txtothername]

Any idea what's wrong? Thanks.
ck
 
Back
Top