i am trying to fill a tree view such that
+month
(opens to ->)
dates
(opens to->)
engine serial number
(opens to->)
engine result
but its show an error when i expand the date part
kindly help me out coz its very important..
Thanking you,
SAKHIB
+month
(opens to ->)
dates
(opens to->)
engine serial number
(opens to->)
engine result
but its show an error when i expand the date part
kindly help me out coz its very important..
Private Sub tvwSelect_Expand(ByVal Node As MSComctlLib.Node)
Dim Connection As New ADODB.Connection ' Use ADO for the connection
Dim RS As New ADODB.Recordset
Dim SQL As String
Dim NodeLevel As Integer
Dim RootNode As Node
Dim nodx As Node
Dim ENGINE_SERIAL_NUM As String
' Implement "On-demand" node expansion
' Open the connection
Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\SAJJ.mdb;Mode=Read"
Connection.Open
NodeLevel = 0
' Traverse to the Root node
Set RootNode = Node
While Not (RootNode.Parent Is Nothing)
NodeLevel = NodeLevel + 1
Set RootNode = RootNode.Parent
Wend
' Check if this node has already been expanded
If NodeLevel <> 2 Or Node.Children > 1 Then GoTo Cleanup
' Remove Dummy node if it exists
If Node.Children = 1 Then
tvwSelect.Nodes.Remove Node.Child.Index
End If
' Load the ENGINE RESULT for this ENGINE SERIAL from the database
ENGINE_SERIAL_NUM = Node.Text
SQL = "Select * From " & Node.Parent.Tag & " Where ENGINE_SERIAL_NUM = '" & ENGINE_SERIAL_NUM & "'" & _
" Order By DATEE"
[u]RS.Open SQL, Connection, adOpenDynamic, adLockPessimistic, adCmdText[/u]' I AM GETTING A RUNTIME ERROR :NO VALUE GIVEN FOR ONE OR MORE PARAMETERS
While Not RS.EOF
Set nodx = tvwSelect.Nodes.Add(Node.Parent.Tag + ENGINE_SERIAL_NUM, tvwChild, RootNode.Tag +ENGINE_SERIAL_NUM+RS!ENGINE_RESULT, RS!ENGINE_RESULT)
nodx.Checked = nodx.Parent.Checked
RS.MoveNext
Wend
RS.Close
Cleanup:
Set Connection = Nothing
Set RS = Nothing
End Sub
Thanking you,
SAKHIB