Jim Hewson
JHewson at karta.com
Fri Apr 11 15:03:36 CDT 2003
Thanks William, Below is my code for the OnLoad event. BTW there are 43 nodes for the parent, 740 for child 1 and 1290 for child 2. It's strange that the code works from design view to form view but not from the database window to form view. Thanks again Jim Dim db As Database Dim rst As Recordset Dim rstChild1 As Recordset Dim rstChild2 As Recordset Dim objNode As Node Dim strKey As String Dim strParent As String Dim strChild1 As String Dim strChild2 As String Set db = CurrentDb Set rst = db.OpenRecordset("qryTVWLocation") Set rstChild1 = db.OpenRecordset("qryTVWClients") Set rstChild2 = db.OpenRecordset("qryTVWVisits") 'Loop through qryTVWLocation and add each Location name to a node. With rst .MoveFirst If .RecordCount Then Do Until .EOF strKey = "L1" & ![LocationID] Set objNode = tvwClient.Nodes.Add(Key:=strKey, _ Text:=![CityState]) objNode.Sorted = True .MoveNext Loop End If .Close End With 'Loop through qryTVWClients and add each Client to a node. With rstChild1 .MoveFirst If .RecordCount Then Do Until .EOF strKey = "L2" & ![ClientID] strParent = "L1" & ![Location] 'identify the parent key for relative argument Set objNode = _ tvwClient.Nodes.Add(relative:=strParent, _ relationship:=tvwChild, Key:=strKey, _ Text:=![Client Code]) .MoveNext Loop End If .Close End With 'Loop through qryTVWClients and add each Visit to a node. With rstChild2 .MoveFirst If .RecordCount Then Do Until .EOF strParent = "L2" & ![ClientID] strKey = "L3" & ![VisitID] 'identify the parent key for relative argument Set objNode = _ tvwClient.Nodes.Add(relative:=strParent, _ relationship:=tvwChild, Key:=strKey, _ Text:=![Visit]) .MoveNext Loop End If .Close End With db.Close Set rstChild1 = Nothing Set rstChild2 = Nothing Set rst = Nothing Set db = Nothing -----Original Message----- From: William Hindman [mailto:wdhindman at bellsouth.net] Sent: Friday, April 11, 2003 2:31 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Treeview not working when form opens Jim ...it would help to see your code for the Form Load event ...your question doesn't have enough info in it to help us help you :) William Hindman "All it takes for evil to prevail is for good men to do nothing." Edmund Burke ----- Original Message ----- From: "Jim Hewson" <JHewson at karta.com> To: <accessd at databaseadvisors.com> Sent: Friday, April 11, 2003 11:29 AM Subject: [AccessD] Treeview not working when form opens > > I have spent way too much time on trying to figure this out... > A2K, Win2000 > > I have a treeview that does not populate when the form is opened. > It does populate when going from design view to form view. > If I open the queries that generate the nodes before the form opens it works > as intended. > What can be causing this problem? > > TIA > Jim > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com