Hey all,
I need help on a combo selection to load a cls mod in a treview
Here is the cbo
Private Sub cboADO_Click()
On Error Resume Next
Select Case Name
Case "Command Object"
LoadADOComobj
etc
Here is the form load
Private Sub LoadADOComobj()
Dim rsCoding As Recordset
Dim objCom As CommandObjects
Dim objNode As Node
Set objCom = New clsADOComobj
Set rsCoding = objCom.GetADOComObj
Set objNode = tvCodeListing.Nodes("ADOComobj"
Do While objNode.children > 0
tvCodeListing.Nodes.Clear
Loop
Do While Not rsCoding.EOF
tvCodeListing.Nodes.Add "ADOComobj", tvwChild, "" & _
rsCoding("Methods"
, rsCoding("Properties"
rsCoding.MoveNext
Loop
Set rsCoding = Nothing
Set objCom = Nothing
objNode.Tag = "Loading"
End Sub
Here is the class module
Option Explicit
Private comADO As Connection
Private mrsCOM As Recordset
Private Const DATABASE = "Database=CommandObject"
Public Sub GetADOComObj(pCOM As Recordset, Optional ByVal flRefresh As Boolean)
On Error GoTo GetADOComErr
'create connection to database if it doesnot exsist
If comADO Is Nothing Then
Set comADO = New Connection
With comADO
.Provider = "Microsoft.OLEDB.4.0"
.IsolationLevel = adXactReadCommitted
End With
End If
If comADO.State = adStateClosed Then
comADO.Open
End If
mrsCOM.Open = "SELECT * FROM Command Object", cnADO
Set pCOM = mrsCOM
Exit Sub
GetCOMErr:
Err.Raise vbObjectError + 800, "Get ADO Command Objects", Err.Description
Set mrsCOM = Nothing
Set pCOM = Nothing
End Sub
I dont what I have done to not load it or do I have to do what else??
Aaron
I need help on a combo selection to load a cls mod in a treview
Here is the cbo
Private Sub cboADO_Click()
On Error Resume Next
Select Case Name
Case "Command Object"
LoadADOComobj
etc
Here is the form load
Private Sub LoadADOComobj()
Dim rsCoding As Recordset
Dim objCom As CommandObjects
Dim objNode As Node
Set objCom = New clsADOComobj
Set rsCoding = objCom.GetADOComObj
Set objNode = tvCodeListing.Nodes("ADOComobj"
Do While objNode.children > 0
tvCodeListing.Nodes.Clear
Loop
Do While Not rsCoding.EOF
tvCodeListing.Nodes.Add "ADOComobj", tvwChild, "" & _
rsCoding("Methods"
rsCoding.MoveNext
Loop
Set rsCoding = Nothing
Set objCom = Nothing
objNode.Tag = "Loading"
End Sub
Here is the class module
Option Explicit
Private comADO As Connection
Private mrsCOM As Recordset
Private Const DATABASE = "Database=CommandObject"
Public Sub GetADOComObj(pCOM As Recordset, Optional ByVal flRefresh As Boolean)
On Error GoTo GetADOComErr
'create connection to database if it doesnot exsist
If comADO Is Nothing Then
Set comADO = New Connection
With comADO
.Provider = "Microsoft.OLEDB.4.0"
.IsolationLevel = adXactReadCommitted
End With
End If
If comADO.State = adStateClosed Then
comADO.Open
End If
mrsCOM.Open = "SELECT * FROM Command Object", cnADO
Set pCOM = mrsCOM
Exit Sub
GetCOMErr:
Err.Raise vbObjectError + 800, "Get ADO Command Objects", Err.Description
Set mrsCOM = Nothing
Set pCOM = Nothing
End Sub
I dont what I have done to not load it or do I have to do what else??
Aaron