Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
HOME News MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc Scripts Links Discussion
internet.com

» HOME
» NEWS
» FEATURES
» SERIES
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Products
Scripts
Links
» DISCUSSION
» TECH JOBS

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner
Computer Deals
Hurricane Shutters
Server Racks
Build a Server Rack
Web Hosting Directory
Dental Insurance
Laptops
Logo Design
Remote Online Backup
Career Education
Auto Insurance Quote
KVM Switch over IP
KVM over IP
Televisions




MySpace Joins eBay, Yahoo in Open Profile Push

News Corp. Unit Under Fire for Ties to Hacker

Are Non-PC Devices Hurting 'Net Innovation?

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Linked Data Planet Conference & Expo

CA ERwin® Data Modeler Proven database design and modeling. Efficiently analyze, design and deploy effective database solutions. Whitepaper: Manage SQL Server Deployments
Try it free: CA ERwin® Data Modeler


Solaris 8 Migration Assistant
Rapidly move your Solaris 8 application environments to new systems running Solaris 10 with the Solaris 8 Migration Assistant. Reduce migration risk while taking advantage of increased performance, reliability and security of the latest SPARC hardware platforms and Solaris 10 OS. »

 
Sun Eco Innovation: Good for Business, Good for the Environment
A complete solution to help you optimize and refresh your datacenter while properly recycling equipment and eliminating eWaste, including money-saving promotions to lower hardware acquisition costs. »

 
Sun Eco Innovation: Power Calculators
Power consumption has increasingly become a priority in customer's minds when purchasing new systems or storage. Sun's Power Calculators provide data on power consumption of Sun products allowing IT managers to better plan the power requirements in the datacenter to achieve better energy and cost savings. »

 
Optimize the Web Tier: Consolidate to Get More Performance in Less Space and Lower Power Consumption
Expansion in the Web tier is generally accomplished by adding more servers whenever extra capacity is needed. As the pool of servers grows larger, however, the complexity of the environment can grow exponentially. »

Production Manager (hands on)
Aquent
US-MA-Cambridge

Justtechjobs.com Post A Job | Post A Resume
MS Access
October 17, 2002
Access 2000 How To's: Adding a Tree View Control and Filter
By David Nishimoto


Overview

This Access 2000 How To's article explains how to load data into a treeview control. Nodes in a treeview have a parent key and a child key. In this example, the first level of nodes contains process ids and titles. In the second level, Activities represent dependant child nodes. One or more activies are associated as children to the a process.

When the user clicks on a node, its key is parsed and the contents determine the type of node: process or activity. Depending on the type of node, a filter criteria is applied to a join between the process and activity table.


Building the Control

Option Compare Database
Option Explicit

Private Sub FindTreeCtrl_NodeClick(ByVal Node As Object)
    'AT
    Dim iOffset
    Dim iLength
    Dim sId
    Dim i
    Dim ch
    
    iOffset = InStr(Node.Key, "AT")
    If (iOffset > 0) Then
        iLength = Len(Node.Key)
        sId = Mid(Node.Key, iOffset + 2, iLength - iOffset + 1)
        'Filter for a task
        Filter = "Id=" & sId
        FilterOn = True
    Else
        iOffset = InStr(Node.Key, "P")
        
        'Filter for a process
        If iOffset > 0 Then
            iLength = Len(Node.Key)
        
            For i = iOffset To iLength
                ch = Mid(Node.Key, iOffset + i, 1)
                If IsNumeric(ch) = True Then
                    sId = sId & ch
                Else
                    Exit For
                End If
            Next
         
            Filter = "ProcessId=" & sId
            FilterOn = True
        End If
        
    End If
        
End Sub

Private Sub Form_Load()
    Dim objNode As Node
    Dim dbs As Object
    Dim rs As Object
    Dim rs2 As Object
    Dim sProcessId As String
    Dim sProcessName As String
    Dim sActivityId As String
    Dim sActivityTitle As String
    
    Set dbs = CurrentDb
    
    Set rs = dbs.Openrecordset("select * from processes")
    
    With FindTreeCtrl
      .Nodes.Clear
      
      Set objNode = .Nodes.Add(, , "root", "Activities")
      objNode.Expanded = True
      
      Set objNode = .Nodes.Add("root", tvwChild, "TT", "Processes")
      objNode.Expanded = True
      
      Do While Not rs.EOF
            sProcessId = "P" & rs("processid")
            sProcessName = "" & rs("processName")
      
            Set objNode = .Nodes.Add("TT", tvwChild, sProcessId, sProcessName)
            
            Set rs2 = dbs.Openrecordset("select * from activities where processid=" & rs("processid"))
            Do While Not rs2.EOF
                sActivityId = sProcessId & "AT" & rs2("id")
                sActivityTitle = "" & rs2("activitytitle")
                Call .Nodes.Add(sProcessId, tvwChild, sActivityId, sActivityTitle)
                rs2.MoveNext
            Loop
        rs.MoveNext
      Loop
    End With
    
    If Not rs Is Nothing Then
        rs.Close
    End If
    Set rs = Nothing

    If Not rs2 Is Nothing Then
        rs2.Close
    End If
    Set rs2 = Nothing

End Sub


Back to Access 2000 How To's Series Home

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

MS Access Archives

Download: SQL Backup & DBA Best Practices eBook
Download: Solaris 8 Migration Assistant. Run Solaris 8 apps on the latest SPARC systems and Solaris 10.
IT in 2018: Download Free eBook By The Author Of "Does IT Matter?" Simple Registration Is Required.
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers. Sponsored by HP, Citrix, and Intel.
Best Practices: Make the Case for IT Investments. Complimentary Independent Report. Download Now!


Latest Forum Threads
MS Access Forum
Topic By Replies Updated
Export a report into excel Irina_5220 2 May 9th, 08:48 AM
Table Property Question barlowr70 0 May 6th, 10:51 AM
Compile MS Access Database samson 1 May 1st, 03:28 AM
How to connect MS-Access with c++ rockys111 0 April 30th, 01:36 AM







JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES