473,703 Members | 3,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating Recurrsive TreeView in ADP using ADO

Hi all,

Apprecite your help in resolving this tricky issue...

I am trying implementing Recurrsive TreeView in MS. Access 2003 ADP
project. So far, no luck :(

The Problem:

This sample snippet is all written for DAO and doesn't work in ADO
(i.e. ADP). Did someone converted this to ADO yet? I'd appreciate for
any further pointer or code snippet using ADO

DAO code >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>
Option Compare Database
Option Explicit

'============== ===Load Event for the Form=========== ============
'Initiates the routine to fill the TreeView control
'============== =============== =============== =============== =

Private Sub Form_Load()
Const strTableQueryNa me = "Employees"
Dim db As DAO.Database, rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordse t(strTableQuery Name, dbOpenDynaset,
dbReadOnly)
AddBranch rst:=rst, strPointerField :="MainMenu", strIDField:="Su bMenu",
strTextField:=" LastName"
End Sub

'============== === AddBranch Sub Procedure =============== =======
' Recursive Procedure to add branches to TreeView Control
'Requires:
' ActiveX Control: TreeView Control
' Name: xTree
'Parameters:
' rst: Self-referencing Recordset containing the data
' strPointerField : Name of field pointing to parent's primary key
' strIDField: Name of parent's primary key field
' strTextField: Name of field containing text to be displayed
'============== =============== =============== =============== ==
Sub AddBranch(rst As Recordset, strPointerField As String, _
strIDField As String, strTextField As String, _
Optional varReportToID As Variant)
On Error GoTo errAddBranch
Dim nodCurrent As Node, objTree As TreeView
Dim strCriteria As String, strText As String, strKey As String
Dim nodParent As Node, bk As String
Set objTree = Me!xTree.Object
If IsMissing(varRe portToID) Then ' Root Branch.
strCriteria = strPointerField & " Is Null"
Else ' Search for records pointing to parent.
strCriteria = BuildCriteria(s trPointerField, _
rst.Fields(strP ointerField).Ty pe, "=" & varReportToID)
Set nodParent = objTree.Nodes(" a" & varReportToID)
End If

' Find the first emp to report to the boss node.
rst.FindFirst strCriteria
Do Until rst.NoMatch
' Create a string with LastName.
strText = rst(strTextFiel d)
strKey = "a" & rst(strIDField)
If Not IsMissing(varRe portToID) Then 'add new node to the parent
Set nodCurrent = objTree.Nodes.A dd(nodParent, tvwChild,
strKey, strText)
Else ' Add new node to the root.
Set nodCurrent = objTree.Nodes.A dd(, , strKey, strText)
End If
' Save your place in the recordset so we can pass by ref for
speed.
bk = rst.Bookmark
' Add employees who report to this node.
AddBranch rst, strPointerField , strIDField, strTextField,
rst(strIDField)
rst.Bookmark = bk ' Return to last place and continue search.
rst.FindNext strCriteria ' Find next employee.
Loop

exitAddBranch:
Exit Sub

'--------------------------Error Trapping
--------------------------
errAddBranch:
MsgBox "Can't add child: " & Err.Description , vbCritical,
"AddBranch Error:"
Resume exitAddBranch
End Sub

DAO Code ends>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>
Best regards

Alix

Nov 13 '05 #1
0 2088

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6100
by: Karuppasamy | last post by:
Hi I want to populate all the files and folders of System in a Treeview control like Windows Explorer. I try this using File System Objects. But sometimes I am getting an error like 'Access Denied". Why am I getting an error like this? How to populate the TreeView with Folders and files of the System?
2
2681
by: Janus | last post by:
Hello. I need a little advice for populating the treeview control. I dont want my application to hang while populating the treeview, there is a lot of data what's the best approach? Maybe something eventbased but how? please help... Should I avoid populating the treeview control using a thread?
0
1167
by: N-Mayne | last post by:
Hi i was wondering if anyone knew how to Populating a TreeView control with the contents of a class and varibles etc, like netbean does but in C#. Thanks Nick Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
2
1352
by: Mike | last post by:
Hi all, I have a dataset that contains following records: id ref_id level -------------------------------------- A - 0 A1 A 1 A2 A 1 A3 A 1
0
1296
by: Erland | last post by:
Hello all, I have just installed visual studio .net 2005 and started developing programs in asp.net 2.0. I have a scenerio where I have to populate treeview child nodes based on the entries being entered in textbox,but there is this thing I need to consider. Values in treeview nodes should be populated as nodes, all child nodes in this case, as soon as vales are being entered in textbox. That is to say, if I enter H in textbox then H...
0
2291
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User clicks on a node to expand it. 2 - Add a child node to the node clicked by the user saying the tree is loading that part. So here, I also need to expand the node clicked by
2
3185
by: Steve Arndt | last post by:
I'm trying to populate a vb.net treeview using a SQLDataReader at Treeview1_BeforeExpand. Basically I have a Treeview with 5 parent nodes and 1 dummy child node per parent. The first parent node is called Address is the parent I'm trying to add new children under. When BeforeExpand is triggered, it removes the dummy child under the Adress parent node based on e.Node.FirstNode.Remove. Then runs a private sub called PopulateNode with...
0
1472
by: hardieca | last post by:
Hi, I have created a treeview bound to a sitemap provider. I have put it into a user control (the control will be used for similar, but not always identical, functionality). The treeview expresses the hierarchy of sections in my website. In a page that edits sections, I would like to use the treeview to allow the user to select a parent section. My treeview is accurately showing my section tree, but of course when I click a link I am...
2
3461
by: Maddy | last post by:
I need to populate a treeview from a text file. The data in it is in the following form 1. (Parent Node) (a) (Child Node) (b) (Child Node) .. .. .. (k) (Child Node)
0
8763
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9266
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9020
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8972
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6602
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5926
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3128
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2467
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.