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
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