Rec.Open "select * from 入库单明细 order by 上级ID,类别", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
For i = 0 To Rec.RecordCount - 1
Set nodex = TreeView.Nodes.Add("物料类别", tvwChild, "A" & Rec.Fields("上级ID"), Rec.Fields("类别"))