Excel Macro with Access DB - Causing an error

squeakums

Well-known Member
Joined
May 15, 2007
Messages
602
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
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,526
"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?
 

squeakums

Well-known Member
Joined
May 15, 2007
Messages
602
"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.
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,526
What is the complete error message with the error number?
 

Forum statistics

Threads
1,078,373
Messages
5,339,814
Members
399,329
Latest member
Vincitore

Some videos you may like

This Week's Hot Topics

Top