PC Review


Reply
Thread Tools Rate Thread

RE: treeview difficulties

 
 
dch3
Guest
Posts: n/a
 
      10th Jul 2008
One thing to be aware of is that if you populate the treeview from multiple
tables where an Autonumber supplies the primary key, you can't use the
primary key for the records as is. The treeView won't like the same key being
used twice even if it originated from two different tables - the treeview's
not that smart. So if you're listing Vendors and Products as in the list
below you have to have some way making the keys unique. My solution was to
format the keys in a very specific manner as in 08PROVIDER1 and 07PRODUCT1. I
then pass the treeView key to a function that extracts the table keys. The
function basically takes the first two characters of the treeView key using
Left() and then uses a Mid() to pull the key. The first two characters
indicate the length of the qualifier and which allows us to mathmatically
find the start of the tables key.

Starline Limosuinse (1) (08PROVIDER1)
Town Car (1)(07PRODUCT1)
Limosuine (2)(07PRODUCT2)
Associated Transportation (2)(08PROVIDER2)
Town Car (1)(07PRODUCT1)
Limosuine (2)(07PRODUCT2)
Mini-Bus (3)(07PRODUCT3)
First Class Livery (3)(08PROVIDER3)
Mini-Bus (3)(07PRODUCT3)

"Dale_Fye via AccessMonster.com" wrote:

> I'm working on adding a treeview control to a form in my mdb file (using
> Access 2007).
>
> I've added the control and have written some code to populate it. I've tried
> this with a recursive subroutine, and it did not work (displayed the root
> nodes but no children), so I'm attempting to populate it with just a couple
> of nodes, each with two subordinate nodes, using the following code. I get
> no errors when I run this code, but my tree view still only displays the root
> level nodes (Node 1 and Node 2), and not the children.
>
> Any help would be greatly appreciated
>
> Public Sub TreeTest(tvw As MSComctlLib.TreeView)
>
> Dim nd As MSComctlLib.Node
> Dim ndRoot As Node
>
> Set nd = tvw.Nodes.Add(, , "A1", "Node 1")
> Set ndRoot = nd
>
> Set nd = tvw.Nodes.Add(ndRoot.Key, tvwChild, "A2", "Node 1.1")
> Set nd = tvw.Nodes.Add(ndRoot.Key, tvwChild, "A3", "Node 1.2")
>
> Set nd = tvw.Nodes.Add(, , "A4", "Node 2")
> Set ndRoot = nd
>
> Set nd = tvw.Nodes.Add(ndRoot.Key, tvwChild, "A5", "Node 2.1")
> Set nd = tvw.Nodes.Add(ndRoot.Key, tvwChild, "A6", "Node 2.2")
>
> End Sub
>
> My settings for the control are:
> Style: 5 - tvwTrelinesPictureText
> LineStyle: 1 - tvwRootLines (no difference when I change this)
> LabelEdit: 0 - tvwAutomatic
> BorderStyle:0 - ccNone
> Appearance:1 - 3D
> Enabled - Checked
> Scroll - Checked
>
> --
> HTH
>
> Dale Fye
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200807/1
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recreate a >>C# WinForms<< TreeView "state" -after- treeview rebuild ?? Any TreeView GODS out there ?? frostbb Microsoft C# .NET 6 18th Aug 2008 06:08 PM
Re: treeview difficulties Alex Dybenko Microsoft Access VBA Modules 1 10th Jul 2008 04:41 PM
Re: treeview difficulties Graham R Seach Microsoft Access VBA Modules 0 10th Jul 2008 01:57 AM
Generate treeview in server manipulate treeview in client side Ravi Microsoft Dot NET 0 2nd Sep 2004 05:00 PM
Re: TreeView, TreeView.HideSelection=false, Window.Minimize NotYetaNurd Microsoft Dot NET Framework Forms 2 30th Jun 2003 07:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:52 PM.