|
楼主 |
发表于 2018-6-21 12:52
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub ???浥??2()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim myPath As String
myPath = ThisWorkbook.Path & "\?????.mdb"
Dim sq1 As String
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & myPath
sq1 = "select * from ??????? where ???=" & Range("K2") & ""
rst.Open sq1, cnn, adOpenKeyset, adLockOptimistic
Debug.Print Sql
If rst.RecordCount > 0 Then
If MsgBox("????棬?????", vbYesNo + vbQuestion, "??") = vbNo Then: Exit Sub
End If
rst.Close
sq1 = "select * from ???????"
rst.Open sq1, cnn, adOpenKeyset, adLockOptimistic
For I = 1 To 8
rst.AddNew
rst.Fields("???") = Range("K2")
rst.Fields("????") = Range("B3")
rst.Fields("????") = Range("D3")
rst.Fields("????") = Range("RNG" & I)
rst.Fields("???") = Range("ANG" & I)
rst.Update
Next I
HHH:
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
MsgBox "??????"
End Sub
整段代码如上 |
|