|
-
April 4th, 2002, 08:26 AM
#1
connecting to password protected Access table
I have created a small table in Access97 and applied a password. I have then put an ADO control onto a form and used the connection builder to create the connection string. Using Jet3.51 Ole DB
Without the password in Access it connects, but with the password it does not.
I get an error "Test failed because of an error in initializing provider. Can't start your application. Workgroup information file is missing or exclusively opened by another"
Can anyone explain what is going on here and how I correct it.
-
April 4th, 2002, 08:40 AM
#2
Re: connecting to password protected Access table
Make your COnenction string include the Password option ;
Provider=Microsoft.Jet.OLEDB.3.51;Data Source='EnterDBPath';Mode=ReadWrite|Share Deny None;Persist Security Info=False;Jet OLEDB atabase Password='EnterPassword'
Work is necessary for man. Man invented the alarm clock.
-
April 5th, 2002, 02:57 AM
#3
Re: connecting to password protected Access table
I agree that should work - but it dosen't
I get an error password not valid
strDBuser = App.Path & "\Users.mdb"
Cn2 = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & _
strDBuser & ";Mode=ReadWrite|Share Deny None;" & _
"Persist Security Info=false;Jet OLEDB atabase Password='abcd'"
set wsUser = DBEngine.Workspaces(0)
'open database
set DBuser = wsUser.OpenDatabase(strDBuser, , , Cn2)
'open Users table
set rsUser = DBuser.OpenRecordset("UserData", dbOpenTable)
the Access data base is just three columns of data headed Name,Password and Initials
and I have used the Tools>security>set database password to set the password to abcd (all lower case). Still no joy !
-
April 5th, 2002, 03:01 AM
#4
Re: connecting to password protected Access table
Are you putting those single quotes in your Password as shown in your code below ?
Work is necessary for man. Man invented the alarm clock.
-
April 5th, 2002, 03:15 AM
#5
Re: connecting to password protected Access table
I put the single quotes in the connect string
but no quotes in the database password.
Note if I leave empty quotes in the connect string and set no database password it does work
but as soon as I put some characters in it fails
-
April 5th, 2002, 03:18 AM
#6
Re: connecting to password protected Access table
I think this is the problem have your tried it without, I have never used Single Quotes round my password and it works fine ?
Work is necessary for man. Man invented the alarm clock.
-
April 5th, 2002, 04:02 AM
#7
Re: connecting to password protected Access table
if I omit the single quotes I get the same result
Invalid password
-
April 5th, 2002, 07:57 AM
#8
Re: connecting to password protected Access table
I think it is a jet matter.
You should download jet driver from microsoft.com
(last version is not included in Mdac_typ.exe)
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
April 5th, 2002, 08:55 AM
#9
Re: connecting to password protected Access table
You are mixing DAO and ADO methods
it must be:
strDBuser = App.Path & "\Users.mdb"
Set cn2 = New ADODB.Connection
sConn = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & _
strDBuser & ";Mode=ReadWrite|Share Deny None;" & _
"Persist Security Info=false;Jet OLEDB atabase Password='abcd'"
cn2.ConnectionString = sConn
cn2.Open
'open recordset
Set rs = New ADODB.Recordset
sSQL = "select * from YourTable"
rs.Open sSQL, cn2, adOpenDynamic, adLockOptimistic
MsgBox "rs is open"
rs.Close
Set rs = Nothing
Set cn2 = Nothing
Iouri Boutchkine
[email protected]
-
April 24th, 2002, 06:40 AM
#10
Re: connecting to password protected Access table
Here is the way to connect to A password protected Access Database:
Dim cn as new ADODB.Connection
Dim Rs as new ADODB.Recordset
cn.Provider = "Microsoft.Jet.OLEDB.3.51"
cn.Properties("Data source") = "mydatabasepath" 'feg: c:\db1.mdb
cn.Properties("Jet OLEDB atabase Password") = "mypassword"
cn.Open
rs.open "select * from mytable",cn,adopendynamic
I use this code and it works!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|