|
Private Sub Form_Load()
Dim Conn As New ADODB.Connection
Dim Rec As New ADODB.Recordset
Dim nodIndex As Node
Dim strSQL As String
Dim i As Integer
On Error GoTo Err_cw
Set Conn = CurrentProject.Connection
Set nodIndex = TreeView.Nodes.Add(, , "a", "员工列表", "k1")
'' ***********************************************************************************************
'' 设置车间部门
Rec.Open "车间部门", Conn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
For i = 0 To Rec.RecordCount - 1
Set nodIndex = Me.TreeView.Nodes.Add("a", tvwChild, "b" & Rec.Fields("编号"), Rec.Fields("车间部门"), "k1", "k2")
Rec.MoveNext
Next
Rec.Close
Rec.Open "员工工作信息", Conn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
Rec.MoveFirst
For i = 0 To Rec.RecordCount - 1
Set nodIndex = Me.TreeView.Nodes.Add("b" & Rec.Fields("车间部门编号"), tvwChild, , Rec.Fields("员工编号"), "k1", "k2")
Rec.MoveNext
Next
Rec.Close
Exit_cw:
Set Conn = Nothing
Set Rec = Nothing
Exit Sub
Err_cw:
MsgBox Err.Description
Resume Exit_cw
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|