|
请将excel表整理好导入到access中,假设名称为a表
再建一个空表结构与a表相同,称之为b- Dim rs As New ADODB.Recordset
- Dim rst As New ADODB.Recordset
- Dim dtmArray() As String
- Dim I As Integer
- rs.Open "a", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
- rst.Open "b", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
- Do While Not rs.EOF
- dtmArray = Split(Replace(rs.Fields(1), ".", "-"), "/")
- For I = 0 To UBound(dtmArray)
- With rst
- .AddNew
- .Fields(0) = rs.Fields(0)
- .Fields(1) = CDate(dtmArray(I))
- .Update
- End With
- Next
- rs.MoveNext
- Loop
- rst.Close
- rs.Close
- Set rs = Nothing
- Set rst = Nothing
复制代码 |
|