Combining Query result rows

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I have a query that returns upto 10 rows of results. I need these 10 results
concantenated together to form a text string that will be displayed in a text
box on a form. I have created 6 queries and then am joining them with this
string:
Result Test: [qryrmk1].[rmk] & " " & [qryrmk2].[rmk] & " " & [qryrmk3].[rmk]
& " " & [qryrmk4].[rmk] & " " & [qryrmk5].[rmk] & " " & [qryrmk6].[rmk].
The number of rows varies with the input to the queries.
Is there a way to combine all the row results from a query into a single
text string in one, preferably the original query?
 
Tom

You've described "how" you are trying to do something. It all starts with
the data.

Please describe the data structure you're working with.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
the data originates from a large computer dump as a txt file.
the particular field I am interested in is a text field for an order, each
line of text is broken into a separate row/field with a seq_num, when you
query on the order number the output is as seen below:

order seq_num remark
123 1 this is line 1 of the remark field
123 2 this is line 2 of the remark field
123 3 this is line 3 of the remark field

I am trying to get "this is line 1 of the remark field this is line 2 of the
remark field this is line 3 of the remark field" which is the 3 rows of the
query ouput combined together. different order numbers have different number
of rows output from the query, I have seen up to 14 so far.

does this help?

tom


Jeff Boyce said:
Tom

You've described "how" you are trying to do something. It all starts with
the data.

Please describe the data structure you're working with.

Regards

Jeff Boyce
Microsoft Office/Access MVP


Tom said:
I have a query that returns upto 10 rows of results. I need these 10
results
concantenated together to form a text string that will be displayed in a
text
box on a form. I have created 6 queries and then am joining them with
this
string:
Result Test: [qryrmk1].[rmk] & " " & [qryrmk2].[rmk] & " " &
[qryrmk3].[rmk]
& " " & [qryrmk4].[rmk] & " " & [qryrmk5].[rmk] & " " & [qryrmk6].[rmk].
The number of rows varies with the input to the queries.
Is there a way to combine all the row results from a query into a single
text string in one, preferably the original query?
 
the data originates from a large computer dump as a txt file.
the particular field I am interested in is a text field for an order, each
line of text is broken into a separate row/field with a seq_num, when you
query on the order number the output is as seen below:

order seq_num remark
123 1 this is line 1 of the remark field
123 2 this is line 2 of the remark field
123 3 this is line 3 of the remark field

I am trying to get "this is line 1 of the remark field this is line 2 of the
remark field this is line 3 of the remark field" which is the 3 rows of the
query ouput combined together. different order numbers have different number
of rows output from the query, I have seen up to 14 so far.

try the code at

http://www.mvps.org/access/modules/mdl0004.htm
 
John,

Thank you for the response, I am already using a solution very similar to
this, my equivalent strSQL has more fields in the definition and is hard
coded, but the theme is the same.

I would like to try to keep everything in the QUERY Design Grid if possible
for the project I am currently working, is it possible to do there without
reverting to VBA?

tom
 
Not in a reliable method unless you know that you will always have exactly
the same number of remarks for each order.
 

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

Back
Top