|
Private Sub cp()
Dim sz1() As String
Dim str, zd, hao, ad, upd As String
str = "SELECT 表A.* FROM 表a"
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open str, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
For j = 1 To rs.RecordCount
zd = rs.Fields(0)
sz1 = Split(zd, ".")
For i = 0 To UBound(sz1)
hao = Left(sz1(i), InStr(sz1(i), "(") - 1)
ad = Mid(sz1(i), InStr(sz1(i), "(") + 1, Len(sz1(i)) - InStr(sz1(i), "(") - 1)
ad = Replace(ad, ",", ",")
upd = "INSERT INTO 表B(客户号,地址) VALUES(" & "'" & hao & "', '" & ad & "')"
DoCmd.RunSQL upd
Next
rs.MoveNext
Next
rs.Close
End Sub |
|