Valhalla Legends Forums Archive | Visual Basic Programming | Opening database in VB

AuthorMessageTime
nkhan
Hello all

I have Microsoft Access database and I have set a database password on it. I am trying to open the database using the opendatabase method but I do not know how to pass the password.

I am using the following method:

Set dbs = OpenDatabase("c:\database.mdb")

Is there a way that I can supply the password, as the databse that I am trying to open is password protected.

Regards
Naeem Khan
April 20, 2004, 2:19 PM
Lycaon
Add a refence to the ActiveX Data Objects Library and use this:

[code]Dim Conn As New ADODB.Connection

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\database.mdb;" & _
"Jet OLEDB:Database Password=YourPassHere"
Conn.Open[/code]
June 8, 2004, 10:11 PM

Search