3027“无法更新。 数据库或对象是只读的。“从excel中使用make table后

我可以通过excel访问我的数据库,当我尝试再次访问它时,问题就出现了。 看来我在我身后留下了一些东西,但我不明白是什么。

Dim con As ADODB.Connection Dim cmd As ADODB.Command Dim strInput As String Set con = New ADODB.Connection Set cmd = New ADODB.Command strInput = Sheets("base_pivot").Range("I4").Value 'I get the input for the parameter from my sheet base_pivot on the cell I4 With con .Provider = "Microsoft.ACE.OLEDB.12.0" .Open "C:\cmo_accounting\CMO_accounting.mdb" End With With cmd .ActiveConnection = con .CommandText = "mk_edu_ana_invoices" .CommandType = adCmdStoredProc .Parameters.Append cmd.CreateParameter("[input_code_ana]", adChar, adParamInput, 5) .Parameters("[input_code_ana]") = strInput End With cmd.Execute con.Close Set cmd = Nothing Set prm = Nothing Set con = Nothing 

这是我第一次使用它,并且一旦我重新打开excel文件,它就会重新运行。 当excelclosures时,连接似乎closures。

最后我find了我的问题的答案。 它被链接到我的Excel文件中的查询。 当我从我的访问文件刷新数据时,它将访问文件打开。 我从来没有像这样的问题,所以我真的认为这是我的vba代码。 我必须做的是将连接string从“共享拒绝读取”更改为“共享拒绝无”。

感谢你的帮助。