baitmaster
Well-known Member
- Joined
- Mar 12, 2009
- Messages
- 2,042
Good morning all, I have the following piece of code that I use to connect to Access Databases:
I want to apply password protection to the database, but am unsure how to include the password when updating my code. I've tried various things with mixed error messages:
run-time error '-2147217843 (80040e4d)': Cannot start your application. The workgroup information file is missing or opened exclusively by another user
run-time error '-2147467259 (80004005)': could not find installable ISAM
run-time error '-2147217843 (80040e4d)': not a valid password
note, "myPassword" represents the actual password and not e.g. a variable. I've been using Access connection strings - ConnectionStrings.com as a general guide for this update
Code:
Sub connectionOpen()
Set adConn = New ADODB.Connection
With adConn
.CursorLocation = adUseServer
.ConnectionTimeout = 500
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=" & strPathToDB & ";"
.Open
.CommandTimeout = 500
End With
End Sub
I want to apply password protection to the database, but am unsure how to include the password when updating my code. I've tried various things with mixed error messages:
Code:
.ConnectionString = "Data Source=" & strPathToDB & "; password = myPassword"
Code:
.ConnectionString = "Data Source=" & strPathToDB & "; database password = myPassword"
Code:
.ConnectionString = "Data Source=" & strPathToDB & "; Jet OLEDB:Database Password = myPassword"
note, "myPassword" represents the actual password and not e.g. a variable. I've been using Access connection strings - ConnectionStrings.com as a general guide for this update
Last edited: