Click here to Skip to main content
15,662,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Can someone help me to open a Access database (protected with a password) in
my application in Visual Basic 2008. I use Oledb connection to link my Application
to the database. When my Access database is not protected with password
my connection goes well, but I don't know how to set my password of my database
in my application.
I have "googled", but I can't find something that works for me. Pleas Help! :((

That's the code that I have at moment:

Dim connectiestring As String
connectiestring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & My.Settings.LocatieDB & "'"
Dim connectie As New OleDb.OleDbConnection(connectiestring)
Dim SQLcommand As New OleDb.OleDbCommand
SQLcommand.Connection = connectie
Updated 19-Feb-18 8:31am

This should answer your question
Share this answer
William Winner 2-Jun-10 11:56am    
Yep...if you used Security-->Set Database Password, you have to include "Jet OLEDB:Database Password=password" in the connection string.
Have you tried adding ";Password=password;" to the end of your "connectiestring"?

Is it secured with a database level password or a Workgroup? If it is a workgroup you would probably have to provide the user as well so also add "User Id=whatevertheuseridis" to the connection string.
Share this answer
William Winner 2-Jun-10 11:54am    
Reason for my vote of 2
password doesn't work with OLE for a database-wide password.

You have to use "Jet OLEDB:Database Password"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900