Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run msaccess macro from within excel 1

Status
Not open for further replies.

Nogi

Technical User
Dec 10, 2004
132
BE
Hi all,

I have a script that is set to launch an ms access macro from within an excelsheet.

this is the code:

Code:
Sub GetAccess()
    Application.StatusBar = "Working in MS Access"
    Dim MyAccess As Object
    Set MyAccess = CreateObject("Access.Application")
    MyAccess.OpenCurrentDatabase ActiveWorkbook.Path & "\database.mdb"
    MyAccess.DoCmd.RunMacro "Run"
    MyAccess.Quit
    Application.StatusBar = ""
    Application.DisplayAlerts = False
    ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub

Now the database is password protected. Now each time i let the script run, i have to type the database password.

Is there a way to implement the database password in this script?

Many thanks in advance for your helps
 
Something like this ?
MyAccess.OpenCurrentDatabase ActiveWorkbook.Path & "\database.mdb", False, "your password"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hey thanks for the fast response PHV. I've tried out your solution, but came accross a very wierd error.

It sais:

"runtime error 3000", and then "there is no definition for this error".

I think i've read something about this saying that if i safe and close the excelsheet after the script has run, the problem might be solved.

If any of you has an other idea, please feel free to post the solution.

Concerning the password part, that seemed to work like a charm PHV, since the error exists when the macro is already consulted.
So thanks alot for your efford.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top