[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Run Access Macro if DB has password

Posted on 2006-04-07
1
Medium Priority
?
257 Views
Last Modified: 2012-05-05
This one is going to be real simple. I have the following code which works great but prompts the user for the database password.  Is there a way to send the password with the database path so it won't prompt the user?

    Private Sub RunMacro(ByVal sMacro As String)
        Dim oAccess As Object

        oAccess = CreateObject("Access.Application")
        ' Open the database
        oAccess.OpenCurrentDatabase(dbpath)
        Try
            oAccess.DoCmd.RunMAcro(sMacro)
            oAccess.DoCmd.Maximize()
            oAccess.Visible = False
        Catch e As Exception
            MsgBox("Macro is cancelled or does not exist")
        Finally
            oAccess = Nothing
        End Try
    End Sub

0
Comment
Question by:Millkind
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 16402043
The OpenCurrentDatabase method has an optional password parameter:

OpenCurrentDatabase Method
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac10/html/acmthOpenCurrentDatabase.asp

Bob
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question