• Concatenation problem

    Author
    Topic
    #489507

    I am trying to concatenate NameHusband, NameWife, and LastName, where either the husband´s or the wife´s name may be missing. I am OK with a missing wife´s name by using the + symbol rather than the &, but when I throw in the possible missing husband´s name, I can´t get things to work.

    Can somebody help?

    Viewing 1 reply thread
    Author
    Replies
    • #1395371

      G,

      This should cover the bases: [noparse]=CONCATENATE(IF(A1=””,””,A1&” “),IF(B1=””,””,B1&” “),C1)[/noparse]

      HTH :cheers:

      DUH! I thought that was in Excel. However, I think the same thing will work in Access just subistitute field names for the cell references.

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1395574

      please explain this in moredetail.
      Are you using NameHusband + NameWife + LastName?

      • #1395588

        Yes. Here is where I am now.

        Expr1: [tblColonMst]![FstNameHus] & (” y “+[tblColonMst]![FstNameWfe]) & ” ” & [tblColonMst]![LastName1]

        If I have no FstNameHus, I get the “y” in front of FstNameWfe. If I have no FstNameWfe, it works.

        Thanks for the attention.

        • #1395727

          Try this:

          [tblColonMst]![FstNameHus] & (IIF(Nz([tblColonMst]![FstNameHus])=””,””,” y “)+[tblColonMst]![FstNameWfe]) & ” ” & [tblColonMst]![LastName1]

          This adds the ” y ” only if the FstNameHus is not blank. It should work even if your fields allow zero-length strings.

    Viewing 1 reply thread
    Reply To: Concatenation problem

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: