Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

Passing a TreeView control around

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Swimminschrage - 17 Jul 2007 20:32 GMT
I'm trying to pass a TreeView control to a public global method to populate
the tree with data from the DB.

Here's the call I make from the Form Load:

Private Sub Form_Load()
   'Load the tree according to information in the database
   Call treeInit(Me.treeBranches, "SELECT parentId FROM Branches WHERE
parentId = ")
End Sub

Here's the function definition for treeInit():

Public Sub treeInit(ByRef tree As TreeView, qry As String)

treeBranches is the name of the TreeView control that I'm trying to pass
around, but I keep getting a "Type Mismatch" error when I run the code.

Inside of the treeInit method, I'm trying to recursively create the tree by
passing Node objects around (not TreeNodes). Is this allowed? How do I create
a brand new node to store the current value that the recursive call is
working on?

Thanks,

Andy
Graham Mandeno - 17 Jul 2007 22:38 GMT
Hi Andy

The TreeView object is referenced by the Object property of the control, not
the control itself.  So try this:

Call TreeInit(Me.treeBranches.Object, "Select...")
Signature

Good Luck  :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

> I'm trying to pass a TreeView control to a public global method to
> populate
[quoted text clipped - 25 lines]
>
> Andy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.