Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a VB Application with a Access Database Password.

Status
Not open for further replies.

1x2z3

Programmer
Sep 18, 2003
39
ZA
I used a MS Access database with a Database Password in Access to protect the database.

What coding can I use to bypass the Access Database Password when I open the database through a VB Application. It gives me the following error code :

Run-time error ‘-2147217843 (80040e4d:)
Not a valid password.

I used the following code to connect to my database :

Dim cn As ADODB.Connection 'Connect to a Database.
Public rs As ADODB.Recordset 'Set records.

Public Sub OpenConnection()

'Database to be opened.
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\VB\Profiller\Profiller.mdb"
cn.Open

End Sub
 
Your connection string needs to look more like this:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.path & "Db.mdb;Persist Security Info=False;Jet OLEDB:Database Password=password"

BB
 
Thank`s BB : I used following two connection types. My Access Database Password is cats but it still says invaled password. I even tried to just say Database Password = password.

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\VB\Profiller\Profiller.mdb;Jet OLEDB:Database Password=cats"

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= c:\VB\Profiller\Profiller.mdb;Persist Security Info=False;Jet OLEDB:Database Password=cats
 
To get the syntax exactly right, just temporarily put an ADODC control on your form. Then right-click on the control and use the wizard to generate your connection string. You can test the connection within the wizard. When you're done, copy the connection string from the ADODC and use it as normal. You can then delete the ADODC.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top