Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 19th, 2007, 09:02 AM
Registered User
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Merging Data in a Field

I have a table that has a number of records with studentid, their givenname and surname and the extra curricula activity that they took part in. For eg

1 Bill Bloggs Hockey
1 Bill Bloggs Cricket

What I am trying to do is merge the activity field into one so that the record reads

1 Bill Bloggs Hockey, Cricket

Any ideas??

Old November 19th, 2007, 02:43 PM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

It depends on your requirements here. Are you trying to do a permanent consolidation? If so, why this way? Are you trying to do a report, or some other data display only?

This structure should be:




Querying this properly normalized structure would allow you to make meaningful reports without duplication of records, as in your current example. This structure would also allow you to create a query to find out haw many students are playing Hockey, for example, without having to worry about where in the string it was entered, and whether it was spelled correctly by whomever made the entry.

If you are serious about doing this concatenation within a table, it may require some coding. Check out this thread to get started: http://p2p.wrox.com/topic.asp?TOPIC_...rms=medication


Look it up at: http://wrox.books24x7.com
Old November 21st, 2007, 07:48 AM
Registered User
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

I agree that this information should really not be "combined" into the record of a table. It sounds like you are looking for this in a query or for a report.

In a query for the field you could use:
AllInfo:[tablename].[studentid] & " " & [tablename].[givenname] & " " & [tablename].[surname] & " " & [tablename].[activity]

This will give the fieldname in the query of AllInfo combining the data. and leave the actual data intact in the table.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stripping Data from a Field jjc9809 Access VBA 1 July 12th, 2008 08:16 PM
Merging data from separate forms SParisi Infopath 0 January 9th, 2006 02:58 PM
Data field limits rayncarnation Access 1 October 15th, 2005 02:27 PM
Merging Data Mitch SQL Server 2000 0 January 2nd, 2004 05:42 PM
merging data from web form to excel spreadsheet fmh002 Classic ASP Basics 1 June 30th, 2003 04:53 PM

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