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
Solved

Concatenation in MS Access SQL View

Posted on 2013-10-29
4
2,486 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
  • 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

829 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