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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help! Need help with passing the password

Status
Not open for further replies.

dotnetprogrammer

Programmer
Aug 17, 2000
77
0
0
US
I have a MS Access 97 database Macro that I need to run through my vb code. The file is password protected. Could anyone tell me how do I pass PASSWORD information to the MS Access 8.0 Object, so that the database will open without prompting for the password?
Thanks,
fred
 
Include the username and password in your connection string. Here is an ADO example:

adoConn.ConnectionString = "PROVIDER=(driver goes here);Data Source=(path to database goes here);User ID=(username goes here);Password=(password goes here);"

That should do the trick.

Best Regards and many Thanks!
Michael G. Bronner X-)

"He was a wise man who invented beer." Plato
 
I am using 'MS Access 8.0 Object' and the following database open command:
"MSAccess.OpenCurrentDatabase myDatabaseCompletePath".
I wonder, using the 'MS Access 8.0 Object,' can I open the database without it prompting for the password?
-OR-
How do I connect your example with the 'MS Access 8.0 Object' so that, I accomplish the same result?
Thanks!
fred
 
what is the content of the variable myDatabaseCompletePath? perhaps you can add your password and user id there?

I'll look into it and see what I can find out; I haven't used the MSAccess 8.0 Object myself. Best Regards and many Thanks!
Michael G. Bronner X-)

"He was a wise man who invented beer." Plato
 
Here is a code example that connects to an Access 2000 database that has a password. Note the "OLEDB:Database Password" tag. This is how you pass in the database password

Code:
dim g_adoDatabase as ADOD.Connection
g_adoDatabase.CursorLocation = adUseServer
g_adoDatabase.Open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=mypassword;" _
     & "Data Source=" & gsDatabase & ";Mode=Share Deny None;Persist Security Info=False;Jet OLEDB:Database Locking Mode=1;Persist Security Info=False;"
 
To : MichaelBronner,
myDatabaseCompletePath just points to the work data file.
myDatabaseCompletePath = "C:\MyDocuments\MSAccess\Work.mdb"
Thanks,
fred

To: taranis,
I am struggling with making a connection between the ADO Connection Object (g_adoDatabase in your example) and the instance of 'MS Access 8.0 Object' (Named: 'MSAccess' in my code segment above) that I have created in my code. If I could make a connection between the two, I guess, my routine will work as intended.
Thanks,
fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top