|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by JCJG in Microsoft Access Database, Microsoft Excel Spreadsheet Software
Question: Hi, I have some VBA codes to (1) execute an Access Macro in Excel and (2) refresh data from an Access table from the action of the Access Macro in step (1). I have encountered a message saying "Cannot Update. Database or object is read-only" when I run the codes the second time. If I close and reopen the Excel file the codes work. I have tested the steps separately and it looks like the problem is from step (2).
Sub runAccessMacro()
Dim acObj As Object
Set acObj = CreateObject("Access.Appli
cation")
acObj.OpenCurrentDatabase "C:\My Documents\Work\test.accdb"
acObj.DoCmd.RunMacro ("Macro1")
acObj.CloseCurrentDatabase
Set acObj = Nothing
End Sub
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625