ive got an access database which i want to be password protected, how do i access this through VB6? ive tried MSDN and i cant seam to find nething
thanx in advance
chenko
Printable View
ive got an access database which i want to be password protected, how do i access this through VB6? ive tried MSDN and i cant seam to find nething
thanx in advance
chenko
I got a possible answer fer ye...
Set the database password in Access, and then to access it with ADO for instance...
...and now you are once again cool.Code:Dim adoConn As New ADODB.Connection
With adoConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "c:\folder\file.mdb", "admin", "thatpassword"
End With
If your access juz password protected without applied the Workgroup information, then this should be enough.
Code:Dim adoConn As ADODB.Connection
Set adoConn = New ADODB.Connection
adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Password=MyPassword;Data Source=c:\MyDatabase.mdb;"
Because Access maintains passwords in a security module, you have to pass that path in the connection string.
i.e.
"Provider=Microsoft.Jet.OLEDB.4.0;Password=password;User ID=user;Data Source=c:\MyDatabase.mdb;Jet OLEDB:System database=c:\security.mdw"
Cheers,
P.
It occurs to me that you may mean a Database Password as opposed to a username/password. For that you need something like:
"Jet OLEDB:Database Password=dbPassword;"
in your connection string.
Alternatively, are you trying to access Access through Automation? I cannot remember the code directly, but I will dig it out and post if you want it.
Cheers,
P.
yea i do mean database password!
i use this to connect to my database
Set DB = Opendatabase("c:\myfolder\file.mdb")
the format is like this
Set DB = Opendatabase("name as string",[options],[readonly],[connect])
i looked at msdn and found that you can put a password in that peice but i can get it to work and i dont know exaclty the heck it is on bout
thanx in advance
chenko
Oh... chenko, you're using DAO. then it should be look like this-
Assume your password is 1234Code:Set db = DAO.OpenDatabase("C:\1.mdb", False, False, ";pwd=1234")