Solved

Concatenation in MS Access SQL View

Posted on 2013-10-29
4
2,790 Views
Last Modified: 2013-11-15
Hello,

I just modified a report in MS Access (2010) originally developed by another (already gone) person.

I inserted a new field to the already existing report, containing various tables. All very simple and it woks perfectly fine. However, when I wanted to concatenate the results of that field into one row I just Couldn't!!! I tried several functions and even tried the listagg function that works for Oracle 11.2g (which we have), but no luck.

Since the report  is based on Access' SQL View and not in VBA, I had to go to that view to manually try to insert a concatenating function, but none of them seem to be supported.

When I run the query this is what I get:

NAME             TRACKER
John Doe         SKS
John Doe         LHN
John Doe         JM

What I would like to see, as you probably now, is:
NAME             TRACKER
John Doe        SKS, LHN, JM

Is there a way to do it in Access by using the SQL view at all? Is there another way?
Please help!!! I am stuck here.

Thanks
0
Comment
Question by:panterall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 200 total points
ID: 39609707
0
 
LVL 61

Accepted Solution

by:
mbizup earned 300 total points
ID: 39611092
Similar technique with a detailed explanation and custom aggregate function for concatenating records by group, written by matthewspatrick here:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_2380-Domain-Aggregate-for-Concatenating-Values-by-Group-in-Microsoft-Access.html

<<Is there a way to do it in Access by using the SQL view at all? Is there another way?>>

There is no native method to do this in Access SQL, as there may be in Oracle or other database platforms, so the workaround is to use custom VBA functions and include those functions in your queries.

If you find the article helpful, please click the 'Yes' button at the bottom.
0
 
LVL 1

Author Comment

by:panterall
ID: 39622319
Hello capricorn1 and mbizup!!
Thanks for your quick answer. I apologize I didn't answered before, but work has been crazy and I hadn't had the chance to try out your solutions.

I am working on them today and I will get back to you to let you know what I did.
I have to say that these solutions look pretty awesome and just probably what I needed.

Thanks a lot again.
0
 
LVL 1

Author Comment

by:panterall
ID: 39651690
Wow! I tried both solutions and both worked out well for my issue.
I have to say that I am very impressed since I have never expected this could be done this way.

I like mbizup's detailed solution, but also I like capricorn1's concise solution.

Thanks a million guys!!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question