Results 1 to 3 of 3
  1. #1
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295

    How to check if a node of a tree exists

    I have a tree (Microsoft treeview control), I create the nodes with keys equal to a key field in my table.



    My question is: in VBA, how do I test if a node with specified key exists? for example, I want to know if the node of key "T1024" is already created in the tree. When I use treeview.nodes("T1024").text="" or isempty(treeview.nodes("T1024")), it just pop an error when the node is not exists.

    what I can do now is use ON ERROR to trap it, if error is raised, then I think the node is not exists.

    is there a beter to test the existance of a node?

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    well in the db point of reference the key is "equal to a key field in my table".

    If a value is (may be) in a table then one can always determine if it exists with a DLookUp method.

    As to treeview though I really don't know anything about that. But hope this helps a little.

  3. #3
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I can find it in the table, what I want to do is:
    I find a key in the table, then check if the key is in the tree, if is, show the node, is not, add a node.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. if exists UPDATE else INSERT
    By lloyddobler in forum Programming
    Replies: 18
    Last Post: 01-04-2012, 11:35 PM
  2. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM
  3. Add columns if not exists
    By ysrini in forum Access
    Replies: 1
    Last Post: 02-16-2010, 06:39 PM
  4. How to use if not exists in access?
    By halifaxdalRaymondXie in forum Queries
    Replies: 1
    Last Post: 01-14-2010, 03:18 PM
  5. Decision Tree
    By RycherX in forum Forms
    Replies: 1
    Last Post: 12-22-2009, 12:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums