|
本帖最后由 todaynew 于 2010-9-16 13:37 编辑
Function P()
Dim rs1 As New adodb.Recordset
Dim rs2 As New adodb.Recordset
Dim A
Dim i As Long, j As Long
rs1.Open "表1", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs2.Open "表1", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
For i = 1 To rs1.RecordCount
A = Split(rs1("员工").Value, "|")
For j = 0 To UBound(A, 1)
rs2.AddNew
rs2("部门").Value = rs1("部门").Value
rs2("员工").Value = A(j)
rs2.Update
Next
rs1.Delete
rs1.Update
rs1.MoveNext
Next
rs1.Close
rs2.Close
End Function |
|