473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

rake-them-all-into-a-string query: is that possible?

Dear all,

Suppose there is a table whose records contain a textfield TXT, and a query
that returns a subset of that table. Is it possible to have that query
return all the TXT-fields gathered together in one string? I really have no
idea as to how to tackle this. For clarity, here's an example of what I
mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
.... ... ... ... ... ... ...

Now the query should run something like: select all members of the
volleybalteam ( teams.idguy where idsport=1, and that joined on guys, etc),
and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS
Nov 12 '05 #1
4 1367
It's a common need, and it's not possible in a SQL query. You'll have to
write something in VB to concatenate the strings together, or find a way to
eliminate the need to deal with them in concatenated form.

On Tue, 13 Jan 2004 00:20:41 GMT, wn********@yahoo.com wrote:
Dear all,

Suppose there is a table whose records contain a textfield TXT, and a query
that returns a subset of that table. Is it possible to have that query
return all the TXT-fields gathered together in one string? I really have no
idea as to how to tackle this. For clarity, here's an example of what I
mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
... ... ... ... ... ... ...

Now the query should run something like: select all members of the
volleybalteam ( teams.idguy where idsport=1, and that joined on guys, etc),
and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS


Nov 12 '05 #2
Hi WS

Dev Ashish wrote a function called fConcatChild to do this.
you'll find it on:

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

HTH

Peter Franklin

On Tue, 13 Jan 2004 00:20:41 GMT, wn********@yahoo.com wrote:
Dear all,

Suppose there is a table whose records contain a textfield TXT, and a query
that returns a subset of that table. Is it possible to have that query
return all the TXT-fields gathered together in one string? I really have no
idea as to how to tackle this. For clarity, here's an example of what I
mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
... ... ... ... ... ... ...

Now the query should run something like: select all members of the
volleybalteam ( teams.idguy where idsport=1, and that joined on guys, etc),
and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS


Nov 12 '05 #3
wn********@yahoo.com wrote in
news:40*********************@dreader13.news.xs4all .nl:
Dear all,

Suppose there is a table whose records contain a textfield TXT, and a
query that returns a subset of that table. Is it possible to have that
query return all the TXT-fields gathered together in one string? I
really have no idea as to how to tackle this. For clarity, here's an
example of what I mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
... ... ... ... ... ... ...
Now the query should run something like: select all members of the
volleybalteam ( teams.idguy where idsport=1, and that joined on guys,
etc), and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS


This function (as an example) might help.

You could modify it to match your table and fields. GetString take
parameters as to delimters.

And set one of the calculated fields in your query to return it.

CurrentProject.Connection.Execute("SELECT Distinct fldDescription FROM
tbl2002Transactions ORDER BY fldDescription").GetString()

.... assumes AC2K or greater.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4
Thanks to all, but this was by far the best answer. It is a beautiful base
to work from

WS
Dev Ashish wrote a function called fConcatChild to do this.
you'll find it on:

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

HTH

Peter Franklin

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ira | last post by:
I'm on a hosted Linux server and I have an Outer Join query that's returning on one less row than I expect. There are two rows very similar and I expect them both returned. There are similar...
4
by: sah | last post by:
I need some help with the following query: DECLARE @SRV VARCHAR(20), @date smalldatetime SET @SRV = (select @@servername) SET @date = '20040901' select Srv_Name = @SRV, DB_Name = 'DB_NAME',...
3
by: Dan | last post by:
Hello, Am trying to construct a query that'll both compute elapsed time based on certain criteria and sum this up for a subset of records. Sample Data that I'm working with: Row Ev_Time ...
1
by: Geir Baardsen | last post by:
Hi! I might have a difficult cuestion. In our database we have registered different tyres with different dimensions from different suppliers that is both for summer and winter season. Now I...
1
by: Greg Strong | last post by:
Hello All, Any reason why a select query that runs will not run as an update query? What I've done is created a select query that runs successfully. The query has several custom functions to...
6
by: Dixie | last post by:
I have asked this question before, but I could not get the suggested solution work. So I will give more details this time. I have an append query that adds several hundred records to a table...
2
by: capdownlondon | last post by:
MS ACCESS 2003 Is it possible to make a query that searches a table for criteria and then updates the table deleting all of the matched in the query except for the last one (say if the records have...
3
by: pmacdiddie | last post by:
I have this query that when run on Access 2007 works, when run in 2002 it fails with the following error: Incorrect Syntax near '.'. INSERT INTO tblQualitySurvey ( Company, Job_Num,...
1
beacon
by: beacon | last post by:
Hi everybody, I have a combo box field in a table with a number data type that has a row source to another table that has the text value for the item selected. Now, in one of my queries, I...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.