Solved

# how can i open with vba on microsoft access a database that is protected with a password

Posted on 2014-03-10
2,756 Views
hi

i have this code to open a non-protected database
Dim accapp As Access.Application

Set accapp = New Access.Application

accapp.OpenCurrentDatabase d("c:\database\mydatabase.mdb")
accapp.Visible = True


what i have to add to this code to open a database that protected with a password?

thanks
0
Question by:bill201
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 81

Accepted Solution

zorvek (Kevin Jones) earned 125 total points
ID: 39918203
Some sample code illustrating how to do this:

http://msdn.microsoft.com/en-us/library/ms808201.aspx

Additional help constructing connection strings can be found at:

http://www.connectionstrings.com/

Kevin
0

LVL 6

Assisted Solution

c1nmo earned 125 total points
ID: 39918206
0

LVL 58

Assisted Solution

Gary earned 125 total points
ID: 39918224
Another option, authenticating yourself first then carrying on with your code as normal.

http://support.microsoft.com/kb/235422
0

LVL 61

Assisted Solution

mbizup earned 125 total points
ID: 39918226
With the OpenCurrentDatabase command:

Dim accapp As Access.Application
dim strPwd as string

Set accapp = New Access.Application

accapp.OpenCurrentDatabase ("c:\database\mydatabase.mdb",, strPwd)
accapp.Visible = True

0

Author Closing Comment

ID: 39918290
thanks a lot for  your help.
0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…