Results 1 to 4 of 4
  1. #1
    Jeff123 is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    5

    I am having trouble figuring out how to concatenate results from a select function

    Hello, I have a query that produces one column of five rows.

    In each row, there is one sentence.


    I would love if the sentences could be reported in one row, separated by periods.





    Here is my SQL query:


    SELECT TOP 5 Replace([TXT],"Member","Jeff") AS Expr1
    FROM [ADHD/ODD]
    ORDER BY Rnd(Int(Now()*id)-Now()*id);



    An example of a current return would be:


    Asked Jeff Jeff to list ways anger has negatively impacted daily life and health
    Parent(s) were taught the importance of praise, support and encouragement.
    Demonstrated for Jeff that counting backward from 10 to 0 is an effective strategy in remaining calm during an argument.
    Jeff described progress of engaging in recreational activities as generally helpful.
    Staff taught Jeff the reality of natural and logical consequences for disruptive and acting out behaviors.





    I would love to have it return as:


    Asked Jeff Jeff to list ways anger has negatively impacted daily life and health. Parent(s) were taught the importance of praise, support and encouragement. Demonstrated for Jeff that counting backward from 10 to 0 is an effective strategy in remaining calm during an argument. Jeff described progress of engaging in recreational activities as generally helpful. Staff taught Jeff the reality of natural and logical consequences for disruptive and acting out behaviors.



    Unsure if this matters, but I run it in a report, and there would be margins.


    I've searched the web until I'm blue, no luck. Any help is greatly, greatly appreciated! Thanks

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    I think this function will do what you require

    http://allenbrowne.com/func-concat.html

    you may need to modify it slightly to use periods

  3. #3
    Jeff123 is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    5
    Hi, thanks for your reply. I had noticed this link on other searches, but it may not work for me as most query returns will be well beyond 250 characters. I was hoping that there is a syntax option to use in the SELECT line to have the query report in one row. Thank you!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    The +255 characters should not be an issue as long as you don't use the query in another query. The function can also be called from a textbox on report.

    The only other way I know of to get these related records concatenated to a single value would involve writing to a temp table into a memo type field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Concatenate Function for Table1
    By harpreett.singhh@gmail.co in forum Access
    Replies: 1
    Last Post: 03-17-2014, 08:04 PM
  2. Concatenate Results of Query
    By bryan0 in forum Queries
    Replies: 3
    Last Post: 03-02-2014, 12:23 AM
  3. Concatenate function problem
    By Matt18 in forum Programming
    Replies: 1
    Last Post: 11-19-2011, 05:37 AM
  4. I need help figuring out an iif function..
    By kduznetsov in forum Access
    Replies: 1
    Last Post: 03-30-2011, 10:07 AM
  5. Concatenate Query Results
    By Rawb in forum Queries
    Replies: 6
    Last Post: 01-19-2011, 07:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums