从Excel文本框到Access表

时间:2017-09-21 20:39:35

标签: excel vba excel-vba ms-access

我正在尝试将我的Excel工作簿连接到MS Access(ScreeningLogDatabase.accdb)中的表(ScreeningLogsTEST),我收到此错误:

  

运行时错误'3001':参数类型错误,超出可接受范围或彼此冲突

你能帮我弄明白为什么吗?

Sub ADOFromExcelToAccess()

 Dim cn As ADODB.Connection
 Dim rs As ADODB.Recordset

 Set cn = New ADODB.Connection
 cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & _
 "Data Source=Q:\TOC Contract Screenings\ScreeningLogDatabase.accdb"
 Set rs = New ADODB.Recordset
rs.Open “ScreeningLogsTEST”, ActiveConnection:=cn, CursorType:=adOpenDynamic, LockType:=adLockOptimistic

0 个答案:

没有答案