S
sdf
I downloaded a genealogy template from microsoft here
http://office.microsoft.com/en-au/templates/TC011031131033.aspx?CategoryID=CT063459251033
but I noticed there isn't an option to display a treeview for descendants,
only for ancestors. Since I am a beginner I'd like to know how to modify the
code to see the descendants instead.
Here is the code to modify I suppose:
Sub AddParents(ID As Long)
Dim rstParents As New ADODB.Recordset
Dim conGen As New ADODB.Connection
Dim fldCurrent As ADODB.Field
conGen.Open Application.CurrentProject.BaseConnectionString
rstParents.Open "SELECT Father.ID, Father.[Full Name]" & _
"FROM (Individuals INNER JOIN Families ON Individuals.Parents =
Families.[GED Family ID]) LEFT JOIN Individuals AS Father ON
Families.[Father ID] = Father.ID " & _
"WHERE Individuals.ID=" & ID, conGen, adOpenStatic, adLockReadOnly
If rstParents.RecordCount > 0 And rstParents.Fields("Full Name").Value
<> "" Then
Form_GetTreeView.TreeView0.Nodes.Add ID & "a", tvwChild,
rstParents!ID & "a", rstParents![Full Name]
AddParents rstParents!ID
End If
rstParents.Close
rstParents.Open "SELECT Mother.ID, Mother.[Full Name]" & _
"FROM (Individuals INNER JOIN Families ON Individuals.Parents =
Families.[GED Family ID]) LEFT JOIN Individuals AS Mother ON
Families.[Mother ID] = Mother.ID " & _
"WHERE Individuals.ID=" & ID, conGen, adOpenStatic, adLockReadOnly
If rstParents.RecordCount > 0 And rstParents.Fields("Full Name").Value
<> "" Then
Form_GetTreeView.TreeView0.Nodes.Add ID & "a", tvwChild,
rstParents!ID & "a", rstParents![Full Name]
AddParents rstParents!ID
End If
End Sub
Thanks.
http://office.microsoft.com/en-au/templates/TC011031131033.aspx?CategoryID=CT063459251033
but I noticed there isn't an option to display a treeview for descendants,
only for ancestors. Since I am a beginner I'd like to know how to modify the
code to see the descendants instead.
Here is the code to modify I suppose:
Sub AddParents(ID As Long)
Dim rstParents As New ADODB.Recordset
Dim conGen As New ADODB.Connection
Dim fldCurrent As ADODB.Field
conGen.Open Application.CurrentProject.BaseConnectionString
rstParents.Open "SELECT Father.ID, Father.[Full Name]" & _
"FROM (Individuals INNER JOIN Families ON Individuals.Parents =
Families.[GED Family ID]) LEFT JOIN Individuals AS Father ON
Families.[Father ID] = Father.ID " & _
"WHERE Individuals.ID=" & ID, conGen, adOpenStatic, adLockReadOnly
If rstParents.RecordCount > 0 And rstParents.Fields("Full Name").Value
<> "" Then
Form_GetTreeView.TreeView0.Nodes.Add ID & "a", tvwChild,
rstParents!ID & "a", rstParents![Full Name]
AddParents rstParents!ID
End If
rstParents.Close
rstParents.Open "SELECT Mother.ID, Mother.[Full Name]" & _
"FROM (Individuals INNER JOIN Families ON Individuals.Parents =
Families.[GED Family ID]) LEFT JOIN Individuals AS Mother ON
Families.[Mother ID] = Mother.ID " & _
"WHERE Individuals.ID=" & ID, conGen, adOpenStatic, adLockReadOnly
If rstParents.RecordCount > 0 And rstParents.Fields("Full Name").Value
<> "" Then
Form_GetTreeView.TreeView0.Nodes.Add ID & "a", tvwChild,
rstParents!ID & "a", rstParents![Full Name]
AddParents rstParents!ID
End If
End Sub
Thanks.