Concatenate values of one field from multiple records in query

G

Guest

I need to concatenate the contents of a specific field from multiple records
into a single, multi-line result. I know how to use Chr(13) & Chr(10) to get
the carriage returns & linefeeds. The problem is figuring out how to
concatenate the contents of a specific field from multiple records into a
single field in the output of the query.

Real-world explanation: each customer can have multiple notes of different
types, and we need to track them separately. However, in one context, I want
to print a report by customer that shows all notes of a specific type as a
single multi-line memo, with each note on a separate line.

I know I could do all of this opening a recordset & looping through the
notes, building a string as I go, and then saving it to a field in a
temporary table that I use as the source of the report, but isn't there some
easier way? I think I've got tunnel vision on this one.
 
G

Guest

Thanks, again, Duane. Of course! Open the recordset in a function and loop to
build the function's output to the final, concatenated result.

Thanks for the early exit from my tunnel vision on this one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top