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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

many to many query with text formatting

Status
Not open for further replies.

susanLe

Programmer
May 16, 2001
7
US
I need to populate a report using a query that displays data in this way:

First field: ParenLastName, ParentFirstName ParentMid; ParentLastName, ParentFirstName, ParentMid

Second field: ChildLastName, ChildFirstName, ChildMid
Third field: ChildCaseNumber
These two fields (child name and case number) could have several children, but all of them have the same Parent's.

To complicate this a bit more, each of these records are related to one of three types of agreement. It is not uncommon for each family group to have all three agreements.

I am able to get one parent name to display on the report, but the child name is duplicated. The multiple agreement part appears to be fine.

Just to make it more fun, I need to have the parent's names seperated with a semi-colon as one string
( Adams, John J; Adams, Mary ).

Here is what I have:

SELECT DISTINCT Agreement.agreementID, Agreement.agreementType, Agreement.agreementAmountApproved, Agreement.agreementSentDate, Agreement.agreementReceivedDate, qryPersonLastFirstMiddleName.Name AS FamilyName, Left([FamilyName],1) AS FirstLetter, qryChildFirstMiddleLastName.PersonName AS ChildName, Format([Placement]![plAACaseNumber] & [Placement]![plChildAACasePersonLetter],">") AS CasePL, Placement.plDisruptionDate
FROM ((Agreement INNER JOIN (Placement INNER JOIN PlacementAgreement ON Placement.placementID = PlacementAgreement.placementID) ON Agreement.agreementID = PlacementAgreement.agreementID) INNER JOIN qryPersonLastFirstMiddleName ON Placement.recruitmentID = qryPersonLastFirstMiddleName.recruitmentID) INNER JOIN qryChildFirstMiddleLastName ON Placement.biologicalID = qryChildFirstMiddleLastName.biologicalID
WHERE (((Agreement.agreementSentDate) Is Not Null) AND ((Placement.plDisruptionDate) Is Null))
ORDER BY qryPersonLastFirstMiddleName.Name;

This is what the report data looks like:

Adams, Mary <parent> Baby Boy Jones Sissy Jones Sissy Jones Baby Boy Jones <child> 123C 123D 123D 123C <caseNumber>

This is what it should look like:

Adams, Mary; Adams, John J <parent> Baby Boy Jones Sissy Jones <child> 123C 123D <caseNumber>
 
Here is another clue. I verified that the data does get returned in the query. It isn't displaying on the report. Should I have this question moved to the Report Forum?

I need help getting the parent's names put into one field with a semi-colon seperating them. Is there a way to do this in the query?
 
Here is another clue. I verified that the data does get returned in the query. It isn't displaying on the report. Should I have this question moved to the Report Forum?

I need help getting the parent's names put into one field with a semi-colon seperating them. Is there a way to do this in the query?

Also, using the distinct statement elemenates the duplicate child name/case...so that is fixed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top