473,396 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Concatenate a field column into a string

I wish to concatenate a column of email addresses in an access table or query into one string so I can cut and paste the string into the TO: field in an email. I'm using Access 2003.

Can it be done in a query? How do I do it with Access SQL?

Thanks,

Ron
Mar 8 '10 #1
2 7027
ADezii
8,834 Expert 8TB
Assuming your Table Name is Table1 and the E-Mail Address Field in Table1 is named [EMail_Addr], the following Function will return your concatenated String of E-Mail Addressess, Delimited in the proper manner:
Expand|Select|Wrap|Line Numbers
  1. Public Function fConcatEMailAddr()
  2. Dim MyDB As DAO.Database
  3. Dim rstEAddr As DAO.Recordset
  4. Dim strBuild As String
  5.  
  6. Set MyDB = CurrentDb
  7. Set rstEAddr = MyDB.OpenRecordset("Table1", dbOpenForwardOnly)
  8.  
  9. With rstEAddr
  10.   Do While Not .EOF
  11.     If ![EMail_Addr] <> "" Then
  12.       strBuild = strBuild & ![EMail_Addr] & ";"
  13.     End If
  14.       .MoveNext
  15.   Loop
  16. End With
  17.  
  18. rstEAddr.Close
  19. Set rstEAddr = Nothing
  20.  
  21. fConcatEMailAddr = Left$(strBuild, Len(strBuild) - 1)
  22. End Function
Mar 8 '10 #2
ADezii:

Thanks for your input. I will give it a shot.

Ron
Mar 8 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: SWN | last post by:
hi. Trying to concatenate two columns: select uname+' '+uaddress as NameAdr from tblUser I only get the first field, name!!?? The datatype is both nvarchar. 100 and 50 chars long. If I...
2
by: Poewood | last post by:
Okay I know this is basic C++ but can someone tell me how to concatenate char to string. Ex: char hexChar={'A','B','C','D','E','F'}; String *str ="A"; how can I do this: str = hexChar +...
10
by: Zontar | last post by:
I'm trying to improve performance on a query, and I was wondering if this is possible in Access. Let's say I have a table with one text column and one row. In that column, I have a field name...
10
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these...
1
by: JB | last post by:
I'm dynamically creating a Gridview object and filling it with contents from an ArrayList as follows: GridView2.AutoGenerateColumns = true; GridView2.DataSource = ArrayListObject;...
15
by: sara | last post by:
I have a Memo field in a table to hold notes from a conversation a social worker has had with a client (this is for a non-profit). If the user needs to update the memo field, I need to find the...
5
by: Dean | last post by:
Hi, I have a table with non-unique identifiers. I need to take all the values with the same ID's and combine them into one field with a semicolon as a seperator. These values may exceed 255...
1
by: Tony Bansten | last post by:
Assume I want to concatenate a literal text value and a variable value for a function parameter then the following does NOT work: objWorkbook.SaveAs("D:\work\v1_" + Filename) The variable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...

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.