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

Column values to single string

P: n/a
Hi

I have an email column in a table. How can I turn values in the column for
all records into a single string with each email separated by a ;?

Thanks

Regards
Oct 1 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

John wrote:
Hi

I have an email column in a table. How can I turn values in the column for
all records into a single string with each email separated by a ;?

Thanks

Regards
try fConcatChild at AccessWeb www.mvps.org/access

or you'd have to create a function to do the concatenation for you.
Something like...

Function ConcatValues(byval strQueryName as string, byval strField as
string) as string
dim rs as dao.recordset
dim qdf as dao.querydef
CONST cstrDELIM As String = ";"
set qdf=dbengine(0)(0).Querydefs("MyQuery")
set rs=qdf.openrecordset
do until rs.EOF
ConcatValues = ConcatValues & cstrDELIM & rs.Fields(StrField)
rs.movenext
loop
ConcatValues=right$(concatvalues,len(ConcatValues)-1)
rs.close
set rs=nothing
set qdf=nothing
End Function

Oct 1 '06 #2

P: n/a
On Sun, 1 Oct 2006 02:29:09 +0100, "John" <Jo**@nospam.infovis.co.uk>
wrote:
>Hi

I have an email column in a table. How can I turn values in the column for
all records into a single string with each email separated by a ;?

Thanks

Regards
If you happen to be using ADO, you could use the GetString Method.

Set cn = CurrentProject.Connection
SQL = "Select EmailAddress from tblPeople"
ToList=cn.Execute(SQL).GetString(adClipString, , ";", " ; ")
-=-=-=-=-=-=-=-=-=-=-=-=
Randy Harris
tech at promail dot com
Oct 1 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.