Hello all,
I have a user getting an error 438, object doesn't support this prop. or
method, when I run code to setup the treeview control. I'm using the
MSCOMCTRL.OCX, file version: 6.01.9545. In my installer, I'm setting it to
always overwrite, btw. Here's my code, maybe I'm doing something that is not
compatible with a new version of MSCOMCTRL?
If I test with the user's db, all is well on my machine.
Thanks!
Andy
Public Function SetupTreeView(S etupType As String)
On Error GoTo ErrRtn
' Add Node objects.
Dim f As Form, firstnode As String, nodX As Node, NodX2 As Node, NodX3 As
Node, NodX4 As Node, db As Database, rs As Recordset, rs2 As Recordset,
criteria As String, rs3 As Recordset, rs4 As Recordset, criteria2 As String,
criteria3 As String
' Declare Node variable.
' First node with 'Root' as text.
If SetupType = "Update" Then
Set f = Forms!fUpdatePa rts.Form
ElseIf SetupType = "AddWizOnly " Then
Set f = Forms!AddaPartW izard.Form
ElseIf WizIsOpen("fSel ectParts") = -1 Then
Set f = Forms!fSelectPa rts.Form
ElseIf WizIsOpen("fPar ts") = True Then
Forms!fParts.Fo rm!PartCatsTree View.Nodes.Clea r
Set f = Forms!fParts.Fo rm
End If
GoSub SetupTree
exitout:
'
'MsgBox "Finished setting up treeviews"
Exit Function
'
SetupTree:
Set db = CurrentDb()
Set rs = db.OpenRecordse t("qrycboFilter ", DB_OPEN_SNAPSHO T)
Set rs2 = db.OpenRecordse t("qrycboFilter Sub", DB_OPEN_SNAPSHO T)
Set rs3 = db.OpenRecordse t("qrycboFilter Sub", DB_OPEN_SNAPSHO T)
Set rs4 = db.OpenRecordse t("qrycboFilter Sub", DB_OPEN_SNAPSHO T)
If Not rs.BOF Then
rs.MoveFirst
firstnode = rs!CatDescripti on
Do Until rs.EOF
'Tree Level 1, Root
Set nodX = f!PartCatsTreeV iew.Nodes.Add(, , Chr(34) &
rs!PartCategory ID & Chr(34), rs!CatDescripti on)
' This next node is a child of Node 1 ("Root").
criteria = "CategoryOf ID = " & rs!PartCategory ID
rs2.FindFirst criteria
Do Until rs2.NoMatch
'Tree Level 2
Set NodX2 = f!PartCatsTreeV iew.Nodes.Add(n odX, tvwChild, Chr(34)
& rs2!PartCategor yID & Chr(34), rs2!CatDescript ion)
criteria2 = "CategoryOf ID = " & rs2!PartCategor yID
rs3.FindFirst criteria2
Do Until rs3.NoMatch
'Tree Level 3
Set NodX3 = f!PartCatsTreeV iew.Nodes.Add(N odX2, tvwChild,
Chr(34) & rs3!PartCategor yID & Chr(34), rs3!CatDescript ion)
criteria3 = "CategoryOf ID = " & rs3!PartCategor yID
rs4.FindFirst criteria3
Do Until rs4.NoMatch
'Tree Level 4
Set NodX4 = f!PartCatsTreeV iew.Nodes.Add(N odX3,
tvwChild, Chr(34) & rs4!PartCategor yID & Chr(34), rs4!CatDescript ion)
rs4.FindNext criteria3
Loop
rs3.FindNext criteria2
Loop
rs2.FindNext criteria
Loop
rs.MoveNext
Loop
End If
rs.Close
rs2.Close
rs3.Close
rs4.Close
Set db = Nothing
Return
'cboFilter_Node Click (Me!cboFilter.N odes(firstnode) )
'Set Me!cboFilter.Se lectedItem = Me!cboFilter.Li stItems(1)
ErrRtn:
If Err = 94 Or Err = 13 Then
MsgBox "SetupTreeV iew: You are missing the part type descriptions for
one or more part types. Click on the Setup button, then Part Categories tab
and fill in any missing part type descriptions.", vbCritical, "Missing Part
Category Descriptions"
Exit Function
Else
MsgBox Err.Number & " - " & Err.Description & ", Function:
SetupTreeView", vbCritical
End If
Exit Function
End Function
I have a user getting an error 438, object doesn't support this prop. or
method, when I run code to setup the treeview control. I'm using the
MSCOMCTRL.OCX, file version: 6.01.9545. In my installer, I'm setting it to
always overwrite, btw. Here's my code, maybe I'm doing something that is not
compatible with a new version of MSCOMCTRL?
If I test with the user's db, all is well on my machine.
Thanks!
Andy
Public Function SetupTreeView(S etupType As String)
On Error GoTo ErrRtn
' Add Node objects.
Dim f As Form, firstnode As String, nodX As Node, NodX2 As Node, NodX3 As
Node, NodX4 As Node, db As Database, rs As Recordset, rs2 As Recordset,
criteria As String, rs3 As Recordset, rs4 As Recordset, criteria2 As String,
criteria3 As String
' Declare Node variable.
' First node with 'Root' as text.
If SetupType = "Update" Then
Set f = Forms!fUpdatePa rts.Form
ElseIf SetupType = "AddWizOnly " Then
Set f = Forms!AddaPartW izard.Form
ElseIf WizIsOpen("fSel ectParts") = -1 Then
Set f = Forms!fSelectPa rts.Form
ElseIf WizIsOpen("fPar ts") = True Then
Forms!fParts.Fo rm!PartCatsTree View.Nodes.Clea r
Set f = Forms!fParts.Fo rm
End If
GoSub SetupTree
exitout:
'
'MsgBox "Finished setting up treeviews"
Exit Function
'
SetupTree:
Set db = CurrentDb()
Set rs = db.OpenRecordse t("qrycboFilter ", DB_OPEN_SNAPSHO T)
Set rs2 = db.OpenRecordse t("qrycboFilter Sub", DB_OPEN_SNAPSHO T)
Set rs3 = db.OpenRecordse t("qrycboFilter Sub", DB_OPEN_SNAPSHO T)
Set rs4 = db.OpenRecordse t("qrycboFilter Sub", DB_OPEN_SNAPSHO T)
If Not rs.BOF Then
rs.MoveFirst
firstnode = rs!CatDescripti on
Do Until rs.EOF
'Tree Level 1, Root
Set nodX = f!PartCatsTreeV iew.Nodes.Add(, , Chr(34) &
rs!PartCategory ID & Chr(34), rs!CatDescripti on)
' This next node is a child of Node 1 ("Root").
criteria = "CategoryOf ID = " & rs!PartCategory ID
rs2.FindFirst criteria
Do Until rs2.NoMatch
'Tree Level 2
Set NodX2 = f!PartCatsTreeV iew.Nodes.Add(n odX, tvwChild, Chr(34)
& rs2!PartCategor yID & Chr(34), rs2!CatDescript ion)
criteria2 = "CategoryOf ID = " & rs2!PartCategor yID
rs3.FindFirst criteria2
Do Until rs3.NoMatch
'Tree Level 3
Set NodX3 = f!PartCatsTreeV iew.Nodes.Add(N odX2, tvwChild,
Chr(34) & rs3!PartCategor yID & Chr(34), rs3!CatDescript ion)
criteria3 = "CategoryOf ID = " & rs3!PartCategor yID
rs4.FindFirst criteria3
Do Until rs4.NoMatch
'Tree Level 4
Set NodX4 = f!PartCatsTreeV iew.Nodes.Add(N odX3,
tvwChild, Chr(34) & rs4!PartCategor yID & Chr(34), rs4!CatDescript ion)
rs4.FindNext criteria3
Loop
rs3.FindNext criteria2
Loop
rs2.FindNext criteria
Loop
rs.MoveNext
Loop
End If
rs.Close
rs2.Close
rs3.Close
rs4.Close
Set db = Nothing
Return
'cboFilter_Node Click (Me!cboFilter.N odes(firstnode) )
'Set Me!cboFilter.Se lectedItem = Me!cboFilter.Li stItems(1)
ErrRtn:
If Err = 94 Or Err = 13 Then
MsgBox "SetupTreeV iew: You are missing the part type descriptions for
one or more part types. Click on the Setup button, then Part Categories tab
and fill in any missing part type descriptions.", vbCritical, "Missing Part
Category Descriptions"
Exit Function
Else
MsgBox Err.Number & " - " & Err.Description & ", Function:
SetupTreeView", vbCritical
End If
Exit Function
End Function