Open a Password-Protected Database

F

fred

Testing "MS Knowledge Base Article - 235422 - Open
a Password-Protected Database...", I was able to open
a "protected.mdb" with a " "second.mdb" as illustrated
in the article. My problem is, as soon as the
"protected.mdb" is opened by the "second.mdb", I
immediately close the "second.mdb". When I do this, I
get the "...There was a problem sending the command to
the program" error message for the "second.mdb". Is
there a way to avoid this error message? I want to
make the "second.mdb" 'transparent' to the user.

Below is the code for the start form for the "second.mdb":

Private Sub Form_Load()
OpenPasswordProtectedDB ' 235422 subroutine in module
DoCmd.Quit
End Sub
 
T

tina

i notice you have your code in the form's Load event, which can't be
cancelled. have you tried

Private Sub Form_Open(Cancel As Integer)
OpenPasswordProtectedDB ' 235422 subroutine in module
Cancel = True
DoCmd.Quit
End Sub

hth
 
F

fred

tina,

The "Cancel" line didn't work. Where do you
think should the code be executed if you
think the Load event might be the one causing
the problem? All I want is to execute the
subroutine from the "second.mdb" and immediately
close the "second.mdb". The "protected.mdb" will
take over the session. Is there a more efficient
way of doing this?
 
T

tina

sorry, fred, that was the extent of my ideas. suggest if you don't get any
other responses today, that you re-post tomorrow.
 
F

fred

tina,

thanks...

FRED
-----Original Message-----
sorry, fred, that was the extent of my ideas. suggest if you don't get any
other responses today, that you re-post tomorrow.





.
 
T

TC

Maybe it doesn't like you quitting the database while the Open or Load
events are still running. (I don't have Access here to check.) Try moving
the Quit command to the Current event of the form. Or, move it to the Timer
event, and have Open or Load say: Me.Timer=1000.

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top