By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,935 Members | 1,387 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,935 IT Pros & Developers. It's quick & easy.

Concatenate multiple rows into one string

P: n/a
Hi,

I have the following table:

Project Name email_addr
happy ja********@happy.com
happy jo********@lappy.com
happy ma********@happy.com
sad jo********@lappy.com
paper ma********@happy.com
paper jo*******@happy.com

What I would like to end up with is if I select project happy is:

ja********@happy.com;jo********@lapp... **@happy.com

Any help would be greatly appreciated.

Thanks
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 18 Jun 2004 07:08:47 -0700, Sm******@aol.com (Smythe32) wrote:

You'll have to do that with a recordset: open a recordset on a query
that pulls the right rows, then loop over it, and for each row add the
email address and a semicolon to a string variable. At the very end
remove the last semicolon.

-Tom.

Hi,

I have the following table:

Project Name email_addr
happy ja********@happy.com
happy jo********@lappy.com
happy ma********@happy.com
sad jo********@lappy.com
paper ma********@happy.com
paper jo*******@happy.com

What I would like to end up with is if I select project happy is:

ja********@happy.com;jo********@lappy.com;ma***** ***@happy.com

Any help would be greatly appreciated.

Thanks


Nov 13 '05 #2

P: n/a
Tom van Stiphout <to*****@no.spam.cox.net> wrote in message news:<57********************************@4ax.com>. ..
On 18 Jun 2004 07:08:47 -0700, Sm******@aol.com (Smythe32) wrote:

You'll have to do that with a recordset: open a recordset on a query
that pulls the right rows, then loop over it, and for each row add the
email address and a semicolon to a string variable. At the very end
remove the last semicolon.

-Tom.

There's an example of this here:
http://www.mvps.org/access/modules/mdl0004.htm
or here..
http://www.mvps.org/access/modules/mdl0008.htm
Nov 13 '05 #3

P: n/a
pi********@hotmail.com (Pieter Linden) wrote in message news:<bf*************************@posting.google.c om>...
Tom van Stiphout <to*****@no.spam.cox.net> wrote in message news:<57********************************@4ax.com>. ..
On 18 Jun 2004 07:08:47 -0700, Sm******@aol.com (Smythe32) wrote:

You'll have to do that with a recordset: open a recordset on a query
that pulls the right rows, then loop over it, and for each row add the
email address and a semicolon to a string variable. At the very end
remove the last semicolon.

-Tom.

There's an example of this here:
http://www.mvps.org/access/modules/mdl0004.htm
or here..
http://www.mvps.org/access/modules/mdl0008.htm

I am unable to get this code to work. I think it has something to do
with I am looking at a string instead of a long.
Nov 13 '05 #4

P: n/a
Sm******@aol.com (Smythe32) wrote in message news:<7f**************************@posting.google. com>...
pi********@hotmail.com (Pieter Linden) wrote in message news:<bf*************************@posting.google.c om>...
Tom van Stiphout <to*****@no.spam.cox.net> wrote in message news:<57********************************@4ax.com>. ..
On 18 Jun 2004 07:08:47 -0700, Sm******@aol.com (Smythe32) wrote:

You'll have to do that with a recordset: open a recordset on a query
that pulls the right rows, then loop over it, and for each row add the
email address and a semicolon to a string variable. At the very end
remove the last semicolon.

-Tom.

There's an example of this here:
http://www.mvps.org/access/modules/mdl0004.htm
or here..
http://www.mvps.org/access/modules/mdl0008.htm

I am unable to get this code to work. I think it has something to do
with I am looking at a string instead of a long.


Sounds like you're not passing the right value to the function - if
you specify that the field is a string, it should add the delimiters
for you. Or of course, you could do as Tom suggested...
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.