小编use*_*351的帖子

用于更新/创建从Excel到Access的新记录的VBA代码

我一直在努力寻找答案,但我在VBA中的低技能真的无法帮助我弄清楚我想要编写什么.

到目前为止我有这个代码:

Sub ADOFromExcelToAccess()
' exports data from the active worksheet to a table in an Access database
' this procedure must be edited before use
Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
' connect to the Access database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & _
    "Data Source=\\GSS_Model_2.4.accdb;"
' open a recordset
Set rs = New ADODB.Recordset
rs.Open "Forecast_T", cn, adOpenKeyset, adLockOptimistic, adCmdTable
' all records in a table
For i = 4 To …
Run Code Online (Sandbox Code Playgroud)

excel ms-access vba

10
推荐指数
2
解决办法
5万
查看次数

标签 统计

excel ×1

ms-access ×1

vba ×1