Connect to password protected database

10-27-2004, 01:22 AM
How do I connect to an access database that is password protected? I'm not using user level sequrity, only the database is protected from opening.

The following code generates an error "Wrong password". If I include the password in the connectionstring the error is "Can't find sequrity file" or something like it.

Public cn As ADODB.Connection

Public Sub ConnectToDatabase()

Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & _
strDBPath & "db1.mdb;"

End Sub

10-27-2004, 02:29 AM
Maybe this can be of any help:

10-27-2004, 04:13 AM
Thank you!
The solution was:

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & _
strDBPath & "db1.mdb;Jet OLEDB:Database Password=drowssap"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum