Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Concatenate names

Geek News

Concatenate names
"bhrosey via AccessMonster.com" <u33878[ at ]uwe> 12/29/2008 2:13:10 PM
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.

--
John 3:16 "For God so loved the world that He gave His only begotten Son, so
that whoever believes in Him shall not perish, but have eternal life"

Message posted via http://www.accessmonster.com

Re: Concatenate names
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 12/29/2008 2:25:14 PM
On Mon, 29 Dec 2008 14:13:10 GMT, "bhrosey via AccessMonster.com"
<u33878[ at ]uwe> wrote:

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

-Tom.
Microsoft Access MVP


[Quoted Text]
>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.
Re: Concatenate names
"bhrosey via AccessMonster.com" <u33878[ at ]uwe> 12/29/2008 2:51:52 PM
That put the names there but there was no "&" between them. How do I get
that to show up?

Tom van Stiphout wrote:
[Quoted Text]
>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.

--
John 3:16 "For God so loved the world that He gave His only begotten Son, so
that whoever believes in Him shall not perish, but have eternal life"

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Re: Concatenate names
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/29/2008 3:47:38 PM
bhrosey via AccessMonster.com wrote:
[Quoted Text]
> That put the names there but there was no "&" between them. How do I
> get that to show up?
>
[membername] & " & " + [spousename]


Re: Concatenate names
"BruceM" <bamoob[ at ]yawhodotcalm.not> 12/29/2008 4:24:44 PM
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" <mddotpainter[ at ]sbcglobal.net> wrote in message
news:Um66l.7584$pr6.6233[ at ]flpi149.ffdc.sbc.com...
[Quoted Text]
> bhrosey via AccessMonster.com wrote:
>> That put the names there but there was no "&" between them. How do I
>> get that to show up?
>>
> [membername] & " & " + [spousename]
>
>

Re: Concatenate names
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/30/2008 2:31:55 AM
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)

BruceM wrote:
[Quoted Text]
> 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" <mddotpainter[ at ]sbcglobal.net> wrote in message
> news:Um66l.7584$pr6.6233[ at ]flpi149.ffdc.sbc.com...
>> bhrosey via AccessMonster.com wrote:
>>> That put the names there but there was no "&" between them. How do
>>> I get that to show up?
>>>
>> [membername] & " & " + [spousename]


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net