473,606 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Column values to single string

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
2 1854

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(by val 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.openreco rdset
do until rs.EOF
ConcatValues = ConcatValues & cstrDELIM & rs.Fields(StrFi eld)
rs.movenext
loop
ConcatValues=ri ght$(concatvalu es,len(ConcatVa lues)-1)
rs.close
set rs=nothing
set qdf=nothing
End Function

Oct 1 '06 #2
On Sun, 1 Oct 2006 02:29:09 +0100, "John" <Jo**@nospam.in fovis.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.Execu te(SQL).GetStri ng(adClipString , , ";", " ; ")
-=-=-=-=-=-=-=-=-=-=-=-=
Randy Harris
tech at promail dot com
Oct 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3760
by: TimG | last post by:
12.) Now you have two different tables - each with two columns. Table #1 Single Column 2 rows with a value equal to 1 and 2
20
2748
by: Steve Jorgensen | last post by:
Hi all, I've just finished almost all of what has turned out to be a real bear of a project. It has to import data from a monthly spreadsheet export from another program, and convert that into normalized data. The task is made more difficult by the fact that the structure itself can vary from month to month (in well defined ways). So, I used the SQL-centric approach, taking vertical stripes at a time so that, for instance, for each...
1
5305
by: nate axtell | last post by:
In VB .NET I load the contents of an Excel or comma seperated values file into a dataGrid (via a datatable). One of the columns has a comma in the name of the column. So for the comma separated values files I put double quotes are the column name. What I see is that the name ends up getting displayed correctly in the DataGrid column, "Class (1,2,3)". When I click on the column to sort I see the following error: "Additional information:...
6
2739
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is freeze.
6
2420
by: Steve | last post by:
I realize that this probably isn't a best practice, but I'm working with legacy code that has a query stored in one column of a table. Because the queries vary, the JSP page that selects a query and runs it cannot add any additional information (like a WHERE clause). I need to add a few more records to the the table, and would like the query to include a value from another field in the current row in a WHERE clause -- something like...
13
2588
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I want to create a new column in a datatable from two existing columns. I have no problem to create the new column using the datatable.columns.add method. The problem is the value of the new column may become system.dbnull since one of the two existing columns may have system.dbnull. How can I fix it so the new column will get the value of the other column even the other column is system.dbnull?
2
5713
denny1824
by: denny1824 | last post by:
Hi everyone, Here is my problem. I have a Table Variable (I could easily turn it into a Temp Table instead) that will sometimes have rows that are identical except for one specific column. The column is of nvarchar. When the rest of the columns for those rows are identical, I want to combine all of the values of that column into a single nvarchar with a delimiter in between each value. Then combine the rows where all of the other columns are...
1
4092
watertraveller
by: watertraveller | last post by:
Hi all. My ultimate goal is to return two columns, where no single value appears anywhere twice. This means that not only do I want to check that nothing from column A appears in column B and vice-versa, but I also don't want the same value appearing twice in A and twice in B. So far I have: --Diff the columns INSERT INTO @Table SELECT One, Two FROM @Column1 a FULL OUTER JOIN @Column2 b
5
7667
by: mabrynda | last post by:
Hi, Is there any possibility to sum all the values in many (say n) columns in a single table using VBA in access 2003? Say I have a table with 200 columns. Say the table name is TableCOUNT and the columns inside the table have names such as LX1, LX2,....,LX200. If I use DSum for a single (or a few) columns giving the name of the column, everything is OK. I get a total for this (these) ciolumns: Open "N:\FM AM\TEST_LOG1.txt" For Output As...
0
8024
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8105
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8310
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5466
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3942
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2451
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1305
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.