Concatenate names

  • Thread starter bhrosey via AccessMonster.com
  • Start date
B

bhrosey via AccessMonster.com

I'm using Access 2002 but I haven't used Access for awhile and I forget how
to perform a simple concatenation. I have a table that lists member's name
and spouse's name and on a report I want to concatenate them so that it looks
like "membername & spousename", but if there is no spouse it will just look
like "membername". Please help and keep it simple for me, like I said, I
haven't used Access in over a year so I have forgotten a lot of stuff.

Thanks
God Bless.
 
T

Tom van Stiphout

On Mon, 29 Dec 2008 14:13:10 GMT, "bhrosey via AccessMonster.com"

Try this:
membername & IIf(IsNull(spousename),"", " " & spousename)

-Tom.
Microsoft Access MVP
 
B

bhrosey via AccessMonster.com

That put the names there but there was no "&" between them. How do I get
that to show up?
Try this:
membername & IIf(IsNull(spousename),"", " " & spousename)

-Tom.
Microsoft Access MVP
I'm using Access 2002 but I haven't used Access for awhile and I forget how
to perform a simple concatenation. I have a table that lists member's name
[quoted text clipped - 5 lines]
Thanks
God Bless.
 
B

BruceM

I think there needs to be parentheses around the second part:
[membername] & (" & " + [spousename])

If spousename is null, using the + sign as the concatenation operator means
the entire expression evaluates to Null, so the ampersand will not appear.

Mike Painter said:
bhrosey said:
That put the names there but there was no "&" between them. How do I
get that to show up?
[membername] & " & " + [spousename]
 
M

Mike Painter

I tested it before posting it, but you are right it will not appear.

The display should be "Fred & Martha" if there is a Fred and a Martha, but
just "Fred" if there is no spouse.

W^5
(Which Was What We Wanted)
I think there needs to be parentheses around the second part:
[membername] & (" & " + [spousename])

If spousename is null, using the + sign as the concatenation operator
means the entire expression evaluates to Null, so the ampersand will
not appear.
Mike Painter said:
bhrosey said:
That put the names there but there was no "&" between them. How do
I get that to show up?
[membername] & " & " + [spousename]
 

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

Top