no one is helping...

R

ramon

Hi, I don't know why nobody answers me... If I not beeing
clear please let me know.
Hope someone out there can help.
Here is a copy of my last post.

thx.

hi all,

I want to Open a subform (sfrmDetails) using the NodeClick
event of a Tree View Control in another form (frmOrder)
The TreeViewControl has three levels. First the parent
node is the OrderNo., the child is the PersonResponsible
and the grandChild is the OrderDate.
My problem is in the NodeClick event, if I click on the
OfferNo the subform is displayed correctly because of my
filter definition. The problem is that I don't know how to
define the filter in order that either the OrderNo,
PersonResponsible or OrderDate is clicked the subForm for
the corresponding OrderID should be displayed.
So can you help me please:
a. Creating nodes that show the OrderNo, PersonResponsible
and OrderDate and hides the OrderId but that I can pick
this OrderID for the filter.
b. Define a filter in order to Open sfrmDetails displaying
the right info no matter if the user clicked on the
OrderNo, PersonResponsible or OrderDate
c. suggestions??

I aid with a code found in the knowledge base. The code
looks like this:
=================CODE==================
On Error GoTo errAddBranch
Dim nodCurrent As Node
Dim objTree As TreeView
Dim strCriteria As String
Dim strText As String
Dim strKey As String
Dim nodChild As Node


Set objTree = Me!xTree.Object


rst.Sort = "OfferDate ASC"
rst.MoveFirst
Do Until rst.EOF

strText = rst(strTextField)
strKey = "a" & rst(strIDField)
Set nodCurrent = objTree.Nodes.Add(, , strKey, strText)
Set nodChild = objTree.Nodes.Add(nodCurrent,
tvwChild, , rst(LastName))
Set nodCurrent = nodChild
Set nodChild = objTree.Nodes.Add(nodCurrent,
tvwChild, , rst(varOrderDate))
rst.MoveNext
Loop
exitAddBranch:
Exit Sub
errAddBranch:
MsgBox Err.Number & " " & Err.Description,
vbCritical, "TreeCtl Error:"
Resume exitAddBranch
End Sub
==============END CODE======================

And for the NodeClick Event:
===========BEGIN CODE=======================
Private Sub xTree_NodeClick(ByVal Node As Object)
Dim strSQL As String
strSQL = "OrderNo Like " & Node
DoCmd.OpenForm "sfrmTreeData", acNormal, , strSQL
End Sub
========================END CODE =================

thx
 
G

gandalf

It has been a while since I used a treeview.
'add usage
object.Add(relative, relationship, key, text, image,
selectedimage)

1.Hide the order id
->Put the value into node.key or tag

Perhaps you could change
Set nodChild = objTree.Nodes.Add(nodCurrent,
tvwChild, , rst(LastName))

into

Set nodChild = objTree.Nodes.Add(nodCurrent,
tvwChild,nodcurrent.key & objtree.PathSeparator &
strLastname , rst(LastName))
(key=orderid;Lastname)

or
Set nodChild = objTree.Nodes.Add(nodCurrent,
tvwChild, , rst(LastName))
nodchild.Tag=orderid


Nodeclick
strSQL = "OrderNo Like " & ExtractOrder(node.key)
'something like left(-
DoCmd.OpenForm "sfrmTreeData", acNormal, , strSQL

or
strSQL = "OrderNo Like " & node.tag

I hope this helps you along.
 
R

ramon

Thank you, for me is the first time using the control and
not having good luck..

I tried your code, but since the tree is built in the Open
event of the form, the node.Tag or node.key always keeps
the value of the last item of the record source..
therefore no matter which node is clicked the subform is
loaded for the last item of the record source..

other thougths?? =/

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Filtering Sub Form 1
Unique Key in Treeview 2
Treeview 4
Challenging Recordset 1
Problem with Tree View 2
Problem with Treeview code 3
Oracle returning wrong datatype. 0
treeView key change tracking 10

Top