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

parent child relation

Status
Not open for further replies.

zoglchaim770

Programmer
Jun 19, 2003
15
I have 2 tables
1. Parent
2. Child
Each parent was a more then one child
I need to make a report with header parent. id
where child.firstname will appear separated by comma for example

Dear Mr smith
You have children and their names are
Jouhn, lora, bush, kerry, ……

 
This is one possible solution:

1) Insert a group for the primary key field on the Parent table, you need to display a group footer but not a group header.

2) Put the ChildNameField in the detail section, and set the detail section's visible property to No.

3) Put an unbound text box in the ParentID footer and name it txtChildren.

4) Code the following report events:


Code:
Option Compare Database
Option Explicit

Dim strChildren As String
__________________________________________________________

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    
    If strChildren = "" Then
        strChildren = Me.ChildNameField
    Else
        strChildren = strChildren & ", " & Me.ChildNameField
    End If

End Sub
__________________________________________________________

Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)

    Me.txtChildren = strChildren
    
End Sub
__________________________________________________________

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)

    strChildren = ""

End Sub
__________________________________________________________


Good luck
-Gary


-Gary
 
Or perhaps take a a look at dhookoms faq faq701-4233.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top