Solved Tree View form opening 2 different forms (1 Viewer)

lacampeona

Registered User.
Local time
Today, 20:13
Joined
Dec 28, 2015
Messages
392
Hello experts, i will attach some tree view form example. I need some help.
I dont know what i am doing wrong. I want to open two different form depends if you click parent or the chield field.. I managed to open one and then i get error to the 2 form...and i manage to open the first form and then i get error for the second. i just dont understand why.

I search a lot of tree view forms so i find some on the internet. examples that i find here on the forum ..they were too complex for my purpose. i just need some simple tree view.

Important tables are:
1. tblKolone2
2. tblUporabaKolon

Important querys are :
1. qryElenaTestL1
1. qryElenaTestL2

Important forms are:
1.frmVnosKolone2 my parent form
2.frmKoloneUporabaSUB2 my child form
3.TWTestForm1 my tree view form

what is the problem?
i have two forms.
1. frmVnosKolone2 ...this form is my parent form..
2. frmKoloneUporabaSUB2 .....this form is my child form

i need when user click on parent field I need to open the first form frmVnosKolone2 depending on ID ( primary key- table tblKolone2)
i need when user click on chield field I need to open the second form frmKoloneUporabaSUB2 depending on PrevzemKID ( primary key- table tblUporabaKolon)

i hope someone can take look of my strange problem

thanks in advance
 

Attachments

  • ACC_Treeview006.accdb
    1.6 MB · Views: 213

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:13
Joined
May 21, 2018
Messages
8,527
Code:
  Case 2
        strNodeKey = Split(Node.Key, ".")(0)
        strNodeKey = Replace(strNodeKey, "'", "")
        lngPK = CLng(strNodeKey)

You have some crazy complicated node keys. They have an unwanted ' as well. You can make this way simpler. In the node tag property save the name of the table. The key is the name of the table & the PK
So Example
node key: tblAlbums8
node tag: tblAlbums
to open the form to Square One

AlbumPK = SelectedNode.key - selectedNode.Tag
This is the same for every node in every tree if you follow this paradigm
 

lacampeona

Registered User.
Local time
Today, 20:13
Joined
Dec 28, 2015
Messages
392
Hello
i finally managed to do it in a liitle another way.
your help was good
thank you
and yes it is complicated

 

Users who are viewing this thread

Top Bottom