Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Build Multivalue Output

Status
Not open for further replies.

JoeReed

Programmer
Nov 3, 2003
10
US
Greetings...

We maintain a database for a client as a relational (one to many) database and the client would like us to provide a "flat" file of the data for them to have inhouse.

Current data example

ID ShowCode
10001 CH09
10001 LB09
10001 RN09
10002 CP08
10002 CP09

I would like to build output like this;

ID ShowCodes
10001 CH09*LB09*RN09
10002 CP08*CP09

I have written a program to do this, however can this be done with a query?

Thank you in advance for any information.
 
faq701-4233

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Assuming a second table with the ID field as the primary key and a larger text field ShowCodes.
Run these 4 queries:
Code:
DELETE tblJoeReeds.*
FROM tblJoeReeds;
Code:
INSERT INTO tblJoeReeds ( ID )
SELECT tblJoeReed.ID
FROM tblJoeReed
GROUP BY tblJoeReed.ID;
Code:
UPDATE tblJoeReed 
INNER JOIN tblJoeReeds ON tblJoeReed.ID = tblJoeReeds.ID 
SET tblJoeReeds.ShowCodes = [ShowCodes] & "*" & [ShowCode];
Code:
UPDATE tblJoeReeds 
SET tblJoeReeds.ShowCodes = Mid([ShowCodes],2);



Duane
Hook'D on Access
MS Access MVP
 
Thank you both...I will look at these solutions this weekend. Both look better than the code I had doing this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top