Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Using a password protected access database

Posted on 2006-06-26
5
Medium Priority
?
220 Views
Last Modified: 2010-04-07
Hi Experts.

Im using the following to connect to an access database: -

    Set dbMyDB = OpenDatabase(App.Path & "\db4.mdb")
    Set dbMyDB = OpenDatabase(App.Path & "\db4.mdb")

    Set rsMyRS = dbMyDB.OpenRecordset("Users", dbOpenDynaset)

I know its a crude way of connecting to the database but its easy. I'm trying to find out using the method above, how to connect to a password protected access database.

Many Thanks
Lee
0
Comment
Question by:ljhodgett
[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
  • Learn & ask questions
5 Comments
 
LVL 16

Expert Comment

by:Wadski
ID: 16982613
Hi there ljhodgett,

Using the OpenDatabase command to open a passworded database is covered on this MS support article:
http://support.microsoft.com/?kbid=209953



Wadski
0
 
LVL 15

Accepted Solution

by:
JackOfPH earned 375 total points
ID: 16982625
change it to this...

 Set dbMyDB = OpenDatabase(App.Path & "\db4.mdb", False, False, "MS Access;pwd=mypassword")
 Set dbMyDB = OpenDatabase(App.Path & "\db4.mdb", False, False, "MS Access;pwd=mypassword")

0
 
LVL 16

Expert Comment

by:Wadski
ID: 16982648
Although you should only need one Set dbMyDB line!
0
 
LVL 8

Expert Comment

by:hiteshgupta1
ID: 16983082
Hi,

If you are setting the password through Tools->Security->Database Password, then try this:

With myConnectionObject
     .Provider = "Microsoft.Jet.OLEDB.4.0"
     .Properties(15).Value = "mydatabasepassword"
     .open "C:\mydatabase.mdb"
end with

Property #15 is Jet OLEDB:Database Password and allows you to call the database password!

you can include it in the connection string as follows:
With cnnConnection
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\mydatabase.mdb; Jet OLEDB:Database Password=mydatabasepassword"
        .Open
    End With

Let us know if it helps u!!
0
 
LVL 12

Expert Comment

by:jkaios
ID: 16990267
If you're using DAO:
  Set dbMyDB = OpenDatabase(App.Path & "\db4.mdb", , , ";PWD=mypassword")

If you're using ADO:
  See hiteshgupta1's example above
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 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