Excel Macro with Access DB - Causing an error

squeakums

Well-known Member
Joined
May 15, 2007
Messages
823
Office Version
  1. 365
Trying to run this code in Excel VBA to open an access DB and run it. I'm getting the error "You already have the Database Open"
Now, logic is that I already have it open - but I don't? And, there is no lock on this Access DB in the folder. Any idea to get past this please?

Sub OpenAccess()
With New Access.Application
.OpenCurrentDatabase "G:\clickhere\test.accdb"
.Visible = True
.DoCmd.RunMacro "STEP1_qdelExistingData"
'If you want to close it when done...
.CloseCurrentDatabase
End With
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
"You already have the Database Open"

This sounds like a custom error, not a built in Access error. Was there an error number or any other information? Are you running the code from another database or from Excel or somewhere else?
 
Upvote 0
"You already have the Database Open"

This sounds like a custom error, not a built in Access error. Was there an error number or any other information? Are you running the code from another database or from Excel or somewhere else?

No, and I'm running this in Excel.
 
Upvote 0
What is the complete error message with the error number?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top