troubleshooting Question

Cannot open an access file by triggering excel macro

Avatar of Shanan212
Shanan212Flag for Canada asked on
Microsoft AccessMicrosoft Excel
10 Comments2 Solutions293 ViewsLast Modified:
Sub AccessTest1(oName As String)
      Dim A As Object

      Set A = CreateObject("Access.Application")
      A.Visible = False

      A.OpenCurrentDatabase ("C:\Documents and Settings\All Users\Desktop\TestDB.accdb")

      A.DoCmd.RunMacro "sayhi", oName

End Sub


I have the above macro

when called, it is saying 'Microsoft Office Access cannot open the db because it is missing, or opened exclusively by another user, or it is not an ADP file'

Where as I checked and it is an accdb file and is closed (this gave me the same error even when I copied the db and changed the name in both the file and macro)

Any help is appreciated!
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Database Architect / Application Developer
Join our community to see this answer!
Unlock 2 Answers and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros