[AccessD] Tree View/Images/Command Bar

Drew Wutka DWUTKA at Marlow.com
Thu Sep 16 15:49:17 CDT 2010


I hate to say this, but Access is not a good interface to use a treeview
for.  Two major reasons.  First, if you want to wipe all the nodes in a
treeview, (nodes.clear), the treeview actually unloads each node
individually.  With a small amount of nodes, it's unnoticeable, with
more, you can watch it eating popcorn!  The easiest way to get around
this, is to actually set the treeview up as an array.  Don't use
instance 0, instead, use instance 1, and when you want to wipe the
nodes, just unload the treeview itself and load a new instance.  The
other item is popup menus.  In Access, you can't have control arrays,
and it's popup menus don't work the same as in VB6.

Some tips on Treeviews though... 

Each node needs a unique key.  I recommend that each key gets a prefix
to identify what type of node it is.  Using a delimiter with Split,
makes this very easy.  Therefore, on Node events, when a user clicks a
node, a simple split function can tell your code exactly what node you
should expect.

Build each node as necessary.  

Use HitTest.  (great function!)

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Hewson
Sent: Thursday, September 16, 2010 11:23 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Tree View/Images/Command Bar

I would like a copy.
I too have been frustrated trying to use a treeview.  I have
successfully
created one with three levels and it works, but any ideas on how to make
it
easier to use would be great.

Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tony Septav
Sent: Thursday, September 16, 2010 11:07 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Tree View/Images/Command Bar

Hey John
Would you like to test drive it first and if deemed worthy, sure it
could be
posted.  I was kind of hoping on getting other's input and added to the
primer, so that no one has to go through the frustration, it is gross.

jwcolby wrote:

>Very cool!  I have always wanted to use these things but didn't want to
undergo the frustration.
>
>Why don't you get it posted to our web site.
>
>John W. Colby
>www.ColbyConsulting.com
>
>On 9/16/2010 9:18 AM, Tony Septav wrote:
>  
>
>>Hey All
>>About a week ago I developed a treeview form for a client who had 
>>1,000s of lab results.  About 6 years ago I had developed a fairly 
>>complex treeview form  (10 levels) for a client, but I guess it is old

>>age because I couldn't remember how I did  most of the activities 
>>performed on the form. So basically I had relearn everything all over 
>>again. This became a study in frustration, "Just show me how to do 
>>it.", don't show me a page of cyptic code when I don't understand what

>>I am doing in the first place.
>>
>>Anyway I decided to create a primer or cheat sheet mdb that I could 
>>use as a reference, to be updated as time goes by. It incorporates a 
>>treeview with 4 levels (from simple data tables) , treeview images 
>>(not a big fan of images but sometime I may need them, the images are 
>>poor quality because I just cut and pasted them) and a commandbar for 
>>the treeview.  There is no fancy code (I wanted to keep it bare 
>>bones), some of the code is repetative, and because it is not an 
>>application there is no error trapping, integrity checks, etc.
>>
>>I am not an expert by any means with treeviews and commandbars, but it

>>is a working model.
>>If anyone is interested in working with treeviews and wants to avoid 
>>some of the frustration I went through, I can send you a copy of the 
>>primer offline.  Maybe you can show me a few tips and tricks.
>>
>>Part 2 (when I get some more time) of my primer will incorporate 
>>linked subforms and list boxes.
>>
>>MDB - Access 2000
>>Hopefully everything will work on your machine, as I did read  that 
>>sometimes problems can occur with the controls.
>>
>>
>>
>>
>>    
>>

--
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
The information contained in this transmission is intended only for the person or entity 
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business 
Sensitive material. If you are not the intended recipient, please contact the sender 
immediately and destroy the material in its entirety, whether electronic or hard copy. 
You are notified that any review, retransmission, copying, disclosure, dissemination, 
or other use of, or taking of any action in reliance upon this information by persons 
or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list