报错求解
Public conn As New ADODB.ConnectionPublic Rec As New ADODB.Recordset
Dim stRecQL As String
Dim Item As Integer
Dim i, j, k As Integer
Dim nodindex As Node
Private Sub Command1_Click()
Do Until Rec.EOF
For j = 2 To Rec.Fields.Count - 1
For i = 1 To Rec.RecordCount
MSHFlexGrid1.TextMatrix(i, 1) = Rnd(1)
Rec.MoveNext
Next
Next
Loop
End Sub
Private Sub Form_Load()
With conn
If .State = adStateClosed Then
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "/产量.mdb;Persist Security Info=False"
.Open
End If
End With
Set nodindex = TreeView.Nodes.Add(, , "爷", "井号", "K1")
nodindex.Sorted = True
'* -----------------------------------------------------------------
Rec.Open "产量", conn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
For i = 0 To Rec.RecordCount - 1
Set nodindex = TreeView.Nodes.Add("爷", tvwChild, "父" & Rec.Fields("ID"), Rec.Fields("井号"), "K1")
nodindex.Sorted = True
Rec.MoveNext
Next i
'Rec.Close
'* -----------------------------------------------------------------
End Sub
Private Sub TreeView_NodeClick(ByVal Node As MSComctlLib.Node)
Text1.Text = Rec.RecordCount
For k = 1 To TreeView.Nodes.Count
For i = 2 To Rec.Fields.Count - 1
MSHFlexGrid1.TextMatrix(0, i - 1) = Rec(i).Name
Next i
If TreeView.Nodes(k).Selected Then
For j = 1 To Rec.RecordCount
For i = 2 To Rec.Fields.Count - 1
MSHFlexGrid1.TextMatrix(j, i - 1) = Rec(i).Value
Next i
Rec.MoveNext
Next j
End If
Next k
End Sub