From: Leif on
I would like to delete a node from treeview. I can add, I can rename, but I
don't see a delete method. The work around I've tried is to delete the
record from the table, clear treeview, then repopulate the tree. However,
after doing that my tree is collapsed. Is there a better way to do a delete?

Thanks,
Leif
From: Rob Parker on
AFAIK, there is no delete method for nodes in a treeview control. Your
approach - repopulate the tree - is the only way to do it.

What you can do, though, is to set the expanded property of each node as you
add it. This allows you to open the tree in any state you want it. If you
want/need to open it in its previous state (an unknown mix of true/false
values for each node's expanded property), you'll need to add a field to the
table that the tree is based on, store the appropriate value in it when you
are processing node clicks, and use that in the recordset when you
re-populate the treee to restore its previous state.

HTH,

Rob

BTW, if you can tell me why I keep getting Run-Time Error -2147417848
"Automation error. The object invoked has disconnected from its clients@@"
in a treeview control I'd be eternally grateful! I've used treeview
controls in a couple of databases with no problems, but in another one I get
this error with monotonous regularity - and it usually crashes the whole
application!


"Leif" <Leif(a)discussions.microsoft.com> wrote in message
news:A1CAC8C7-ACF3-4F5D-AB2E-9B7982B124DD(a)microsoft.com...
> I would like to delete a node from treeview. I can add, I can rename, but
I
> don't see a delete method. The work around I've tried is to delete the
> record from the table, clear treeview, then repopulate the tree. However,
> after doing that my tree is collapsed. Is there a better way to do a
delete?
>
> Thanks,
> Leif


From: Leif on
Rob,

Thanks for your reply. I was afraid of that. I probably could use an array
to store the states, but I'm not sure its worth the effort. I see what the
client thinks.

On your problem, I goggled it and came up with the following. Hope it helps.

Receive an Error Like "The object invoked has disconnected from its clients"
and Must Re-Start the Application in Order to Perform Certain Activities
Issue:

A rare/intermittent issue has been observed when using ReliaSoft's software
products on Windows 2000 and some Windows NT systems with 2000 libraries. An
error like "The object invoked has disconnected from its clients" appears and
the user is unable to perform functions associated with the object
disconnect. The problem is resolved by re-starting the application.

Solution:

This problem is due to an issue with Windows 2000, not ReliaSoft software,
as confirmed by Microsoft. Microsoft's support document number Q293631
describes the issue. Microsoft has made a hot fix available and has announced
plans to address this issue with a service pack.



"Rob Parker" wrote:

> AFAIK, there is no delete method for nodes in a treeview control. Your
> approach - repopulate the tree - is the only way to do it.
>
> What you can do, though, is to set the expanded property of each node as you
> add it. This allows you to open the tree in any state you want it. If you
> want/need to open it in its previous state (an unknown mix of true/false
> values for each node's expanded property), you'll need to add a field to the
> table that the tree is based on, store the appropriate value in it when you
> are processing node clicks, and use that in the recordset when you
> re-populate the treee to restore its previous state.
>
> HTH,
>
> Rob
>
> BTW, if you can tell me why I keep getting Run-Time Error -2147417848
> "Automation error. The object invoked has disconnected from its clients@@"
> in a treeview control I'd be eternally grateful! I've used treeview
> controls in a couple of databases with no problems, but in another one I get
> this error with monotonous regularity - and it usually crashes the whole
> application!
>
>
> "Leif" <Leif(a)discussions.microsoft.com> wrote in message
> news:A1CAC8C7-ACF3-4F5D-AB2E-9B7982B124DD(a)microsoft.com...
> > I would like to delete a node from treeview. I can add, I can rename, but
> I
> > don't see a delete method. The work around I've tried is to delete the
> > record from the table, clear treeview, then repopulate the tree. However,
> > after doing that my tree is collapsed. Is there a better way to do a
> delete?
> >
> > Thanks,
> > Leif
>
>
>
From: Rob Parker on
Leif,

Thanks for the feedback on my problem. My previous Googling had found a few
(and I mean few, not hundreds) similar problems/suggestions, related to
various third-party programs; and also a very few with treeview controls in
Access. Unfortunately, some had anything at all useful in suggesting how I
can fix my problem; which isn't caused by anything other than the
combination of Access (2000) and mscomctl.ocx.

I'm still playing (I use that term advisedly - it's actually a real
pain-in-the-bum) with a test database (the real problem one is at work) to
try to reproduce my problem, but with no luck to date.

Rob

<snip>


From: jeff on

First - I find it pretty surprising what you guys are saying about
the standard TreeView. I haven't tried standard MS Treeview
within Access, but in VB you can just write
TreeView1.Nodes.Remove 2
to remove the 2nd node in the tree.

If this doesn't work in Access, then as it sounds like you are open
to other 3rd party Tree controls, definitely you should take a look
a look at our TList 7 control. Of course you can remove nodes
from TList in Access and it is much much faster and more flexible
than MS Treeview as well. In case you already have lots of
MS Treeview syntax we also provide a syntax compatible
wrapper ( TLTreeview ) with TList. ( however using TList directly
without the wrapper gives much better performance )

You can download TList for evaluation from our web site at
www.Bennet-Tec.com Also check out the compatibility
page on our web site for key information about use of TList
within Access


If you are interested I'll be happy to answer questions
on TList for you. I think there are also a few TList users
here in the newsgroup.

* * Please include a copy of this message with your reply

Jeff Bennett
Jeff @ Bennet-Tec.Com

* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
* RELIABLE Components Make You Look Sharp!
* TList/Pro * ALLText HT/Pro * MetaDraw *
* Custom Software Development Services Too.
* WWW.Bennet-Tec.Com

=================== ===================