Hi, I used your sample to get my TreeView Control to work with a parent child table (Modules/Devices). If fills in the parents just find but tells me an element is not found when adding the children, Do I need to set a property or something? My code is below. I am setting the tree on Form Open - Private Sub Form_Open(Cancel As Integer)
-
Dim MyRS As DAO.Recordset
-
Dim MyRSChild As DAO.Recordset
-
Dim strSQL As String
-
-
Me![TreeView1].LineStyle = 1 'Root lines
-
Me![TreeView1].Style = 7 'TreelinesPlusMinusPictureText
-
-
Set MyDB = CurrentDb()
-
Set MyRS = MyDB.OpenRecordset("tblModulHeader", dbOpenDynaset)
-
-
'1-Relative, tvwChild-Relationship, "g"-Key, "George"-Text "ROOT Node"
-
Set nodX = TreeView1.Nodes.Add(, , , "MODULES AND RELATED DEVICES")
-
'Populate Customer Nodes
-
Do While Not MyRS.EOF
-
Set nodX = TreeView1.Nodes.Add(1, tvwChild, "MODULE" & MyRS![Module_ID], MyRS![Module_DESC])
-
nodX.EnsureVisible
-
MyRS.MoveNext
-
Loop
-
-
strSQL = "Select * From tblModuleDetail"
-
Set MyRSChild = MyDB.OpenRecordset(strSQL, dbOpenSnapshot)
-
-
'Populate Module details
-
Do While Not MyRSChild.EOF
-
Set nodX = TreeView1.Nodes.Add("MOD ID" & MyRSChild![Module_ID], tvwChild, "Mat_ID" & MyRSChild![Mat_ID], "Material Description" & CStr(MyRSChild![Material_Desc]))
-
MyRSChild.MoveNext
-
Loop
-
-
'Accentuate the Root by making Text Bold
-
TreeView1.Nodes(1).ForeColor = QBColor(4)
-
-
'Select the Root
-
TreeView1.Nodes(1).Selected = True
-
Me!TreeView1.SetFocus
-
SendKeys "^{HOME}"
-
MyRSChild.Close
-
MyRS.Close
-
Set MyRSChild = Nothing
-
Set MyRS = Nothing
-
-
End Sub
2 1547
I've used TheSmileyCoder's examples and they are great. You might want to just start with his code as your base.
From Add Method (Nodes Collection) the First parameter is defined as:
Relative Optional. The index number or key of a pre-existing Node object.
Based on that, I think what you are running into is that your first parameter needs to resolve to a valid index of an existing node or an actual Parent node passed along to the method: - Set nodX = TreeView1.Nodes.Add(
"MOD ID" & MyRSChild![Module_ID] , tvwChild, "Mat_ID" & MyRSChild![Mat_ID], "Material Description" & CStr(MyRSChild![Material_Desc]))
Lastly, this is a quick and dirty example of adding some Child nodes: - Private Sub Command1_Click()
-
Dim iCount As Integer
-
Dim oBinderNode As MSComctlLib.Node
-
Dim oAttachmentsNode As MSComctlLib.Node
-
-
Me.TreeView0.Nodes.Clear
-
' Create Parent
-
Set oBinderNode = Me.TreeView0.Nodes.Add(, , "Binder:Root", "Root")
-
'Create Children
-
For iCount = 1 To 10
-
Set oAttachmentsNode = Me.TreeView0.Nodes.Add(oBinderNode, MSComctlLib.TreeRelationshipConstants.tvwChild, "Attachment:" & iCount, "Attachment #" & iCount)
-
Next iCount
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
by: TimS |
last post by:
I am getting a baffling File not found error (0x800A0035).
I am writing asp on a windows 2000 server. I build a path and filename from
several fields in a jet database using SQL commands, like...
|
by: Ciaran Byrne |
last post by:
I would like to use the XML API supplied by ClickaTell
(http://www.clickatell.com) in
my code. I have a simple XML file, which I've test in their online demo and
it works
fine. I now want to...
|
by: MLH |
last post by:
I call the following Sub and Function in frmLaunch's OnOpen
event code. I keep getting Property Not Found error for the
AllowBypassKey setting. Failure point is line #30 in the Function
(not the...
|
by: warlord |
last post by:
I have a windows client app that is trying to download a file from
a web server but I always get the following error when I call the
GetResponse method of the Request object.
The remote server...
|
by: jiangyh |
last post by:
hi there:
I use following source to fire outlook express,but I have a file not
found error.
System.ComponentModel.Win32Exception: File not found
...
|
by: vcuser |
last post by:
All,
Can someone please let me know if you have come across this error in VC 7.1 when trying to implement an interface using the "Implement Interface wizard"?
If so, can you please let me know...
|
by: RML |
last post by:
Hi, I have a VS2005 VC++ application which no longer allows me to add a
Variable or Function to a class in the project. I attempt to add a new
(public) Variable called Temp123, and get this...
|
by: priya0123 |
last post by:
:confused: Hi,
I have created a treeview control in asp.net 1.1 and worked perfectly fine on my development box.
Now I have uploaded the pages to my sandbox(test box),
everything is fine there (...
|
by: C.Joseph Drayton |
last post by:
Hi All,
I am not sure if this is a JavaScript or PHP error. Basically what
is happening, is that I have an HTML page with the following
JavaScript. As you can see makeRequest() calls a PHP...
|
by: stmfc |
last post by:
i dont know why pl/sql block below returns no data found error.
do you have any idea about it?
declare
c1 varchar2(80);
c2 varchar2(80);
begin
execute immediate 'select col2 from table1 where...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |