Link to home
Start Free TrialLog in
Avatar of GRIPA1
GRIPA1

asked on

MS Access Treeview generates error 35601 "Element not found"

Hello: (I have a ghost in the machine it seems...)

BACKGROUND INFO:
I've developed an Access 2003 front end to a sql server 2000 backend. The main form uses a treeview control which is populated using an adjacency modeled sql table (i.e., EMP_ID, BOSS_ID) called tbl_Dependencies.

The table tbl_Dependencies also has a third field which tracks the sort order of any row item.  Thus, the table has three fields: EMP_ID (autonumber), BOSS_ID (INT), and SORT_ORDER (INT).

Below is sample data:
EMP_ID  BOSS_ID  SORT_ORDER
1           null            0
2            1               0
3            1             10
4            2               0
5            2              10
6            3                0
7            3               10
8            3               20

On the Access main Form, when a person clicks on a node on the tree, a related subform displays the fields from tbl_Dependencies. A user can add/delete records from the subform quite easily; the subform auto-populates the BOSS_ID when adding new records. Whenever a record is added/deleted/changed in the subform, the event triggers a refresh of the treeview wherein the parent node of the record in the subform is selected so that the subform continues to display the subordinate rows.

I've encountered a problem in only one instance where changing the sort order of an item to show up last generates an error 35601 "Element not found".  This gets even stranger since this error occurs in only one specific location within the tree. The tree actually has hundreds of rows, some nesting 4 to 5 levels deep. Any other part of the tree can have items added or re-ordered to the end of a list without consequence.

But, for some reason, there is one subsection of the tree where VBA or the treeview cannot "tolerate" changing the sort order of an existing item to be last nor to add a new item to be last. A review of the sql table shows that the data is captured correctly, but the treeview fails to display the relationship.

Any thoughts?
--Pete
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Which Treeview control are you using? Access doesn't have a native Treeview ...

Can you show the code where the error occurs?
ASKER CERTIFIED SOLUTION
Avatar of GRIPA1
GRIPA1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GRIPA1
GRIPA1

ASKER

By the way, how do I Cancel my request for help? Do I just delete the question?
You should see a "Delete Question" button ... this will generate a question in Community Support, and they can delete it for you (you can't delete it if Comments have been posted, I believe).