How to open Password Protected Access Database programmatically?

  • Thread starter Günter Brandstätter
  • Start date
G

Günter Brandstätter

Hi all,
I wanted to password-protect an Access-database just to be sure that the
tables are unintendently changed. I know, it is not top of security, but I
can live with it.
What I wanted to know now, if I want to open this database programmatically
using OLE, how do I implement the password in my code?

What I do for the moment (without password) is the following:
myDoc.MailMerge.OpenDataSource Name:=myDB _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=0, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data
Source=myDB;Mode=Read;Extended Properties="""";Jet OLEDB:System
database="""";Jet OLEDB:Registry Path=""""" _
, SQLStatement:="SELECT * FROM `myTable`", SQLStatement1:="", _
SubType:=wdMergeSubTypeAccess

Works fine without password.
I was trying to add "Jet OLEDB:Database Password=myPassword" in the extended
properties section of this string. This did not solve my problem.
It opens a Connection Properties windows, where I could enter the password
manually.

How do I manage to get my password inserted automatically??

any answer appreciated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top