A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Hierarchycal TreeView DB



 
 
Thread Tools Display Modes
  #1  
Old December 22nd, 2009, 12:27 PM posted to microsoft.public.access.forms
vmcduarte
external usenet poster
 
Posts: 1
Default Hierarchycal TreeView DB

Hello!

I have created a very simple hierarchycal list based on the Adjacency-List
model (see DB attached).

I have also created a form with TreeView to browse the hierarchy.

In the form frmProjectos, from the DB attached, I would like that, when the
user clicks on any Project, the form right shows this Project record.

How can I do this?

Thank you!

You can download the sample DB file from:
http://www.utteraccess.com/forums/uadl.php?Zn=1916276

  #2  
Old December 22nd, 2009, 02:06 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Hierarchycal TreeView DB

On Tue, 22 Dec 2009 12:27:33 GMT, "vmcduarte" u56987@uwe wrote:

You need a little bit different approach. First off it is highly
convenient if you use the Primary Key as the Node.Key value. Prefixing
"a" is not really helpful.

Then you can write:
Private Sub xTree_NodeClick(ByVal Node As Object)
Debug.Print "You clicked on node " & Node.Key

Dim lngID As Long
lngID = CLng(Mid(Node.Key, 2)) 'Strip trailing char.

With Me.Parent.RecordsetClone
.FindFirst "IDProjecto=" & lngID
If Not .NoMatch Then
Me.Parent.Bookmark = .Bookmark
End If
End With
End Sub

Btw, your code needs more work. For example you should close all
recordset objects when you are done with them, and set to Nothing.

-Tom.
Microsoft Access MVP



Hello!

I have created a very simple hierarchycal list based on the Adjacency-List
model (see DB attached).

I have also created a form with TreeView to browse the hierarchy.

In the form frmProjectos, from the DB attached, I would like that, when the
user clicks on any Project, the form right shows this Project record.

How can I do this?

Thank you!

You can download the sample DB file from:
http://www.utteraccess.com/forums/uadl.php?Zn=1916276

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.