Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 1st, 2006, 03:48 AM
Authorized User
Join Date: Apr 2004
Location: Cape Town, , South Africa.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lizhaskin
Default Combining Text Fields

Can anyone help me?

I need to combine an undetermined number of text fields into one field in a query. In other words, if I have the following:

ID Name
1 Liz
2 Tertia
3 Peter
4 Paul
5 Sue

I would like to conbine the Name field into one:

Liz ; Tertia ; Peter : Paul ; Sue

There is no definate number of names, so I would need an expression that will combine all Names in the row with a ; in between.
Is this possible?

Reply With Quote
  #2 (permalink)  
Old May 1st, 2006, 06:15 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts


It looks like you are combining all the names in a column, not a row. Where are you getting the data? Is it a query result? Please explain the origin of the data. You can loop through the recordset and then concatenate all the names in a variable like this:

sNamesVar = sNamesVar & "; " & objRS.Names

Or something like that. If you do this after looping through each record, then it will build the string you have.

You may want to look up "Regular Expressions" on msdn for information on concatenating text strings.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
populating online text fields etc hamilton C# 2 June 20th, 2007 09:16 AM
Calculating text fields jayman Classic ASP Basics 13 March 6th, 2006 05:27 AM
specifying number of text fields Astro VB How-To 64 August 9th, 2005 08:02 PM
MySQL Text Fields MAtkins General .NET 0 May 27th, 2005 03:17 PM
Insert two fields or more into one Text Object Itai Crystal Reports 2 May 25th, 2005 05:05 AM

All times are GMT -4. The time now is 10:49 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.