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

Open password protected database

Status
Not open for further replies.

jheiser

Programmer
Dec 19, 2003
14
US
I need to open a password protected database I have tried many different solution none of them have worked this is what I have:

Set objaccess = CreateObject("Access.Application")

With objaccess

.OpenCurrentDatabase "\\vitefpsrv\a368270$\B17Cv1.0s.mdb"
.DoCmd.OpenReport reportname:=rep2, view:=acPreview
.Visible = True
.DoCmd.Maximize 'maximizes the Report window
.DoCmd.Maximize 'maximizes Access window
End With
Set objaccess = Nothing
 
Replace
Code:
 .OpenCurrentDatabase "\\vitefpsrv\a368270$\B17Cv1.0s.mdb"
with
Code:
 .OpenCurrentDatabase "\\vitefpsrv\a368270$\B17Cv1.0s.mdb",,"MyPassword"  
'obviously replace "MyPassword" with the actual password

"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
On a different note, why do you use late binding i.e. CreateObject, instead of a reference to access.
If you had of used the later, you would automtically see the options available for passing the password.
If you require the first option of late binding, you can add a reference during development and then switch to late binding prior to release

"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
Thanks for your help, I decided to go a differnet direction in what i was doing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top