ACCDR vba open with password

beachldy

Registered User.
Local time
Today, 01:20
Joined
Jun 22, 2010
Messages
27
I am trying to open an ACCDR (Access application with runtime extension) from within another ACCDR file. The situation is this: Some users may have the full version of Access 2007 and some may have the runtime version only).

I want the ACCDR file to open with either version. The ACCDR file also has a password, so I need to incorporate that into the code.

Perhaps I need to search for versions, and then use SHELL to open it?
 
Beachldy,

Using the accdr filename extension is a handy way to emulate runtime equivalence for the developer's testing purposes etc. But it would not be a recommended way to distribute your application. I would suggest saving the application as an accde. If, for some unusual reason, it is really important to restrict the users with full Access to runtime functionality, then you can use the /runtime switch on the application launch shortcut.
 
Actually, the ACCDR is working great as an added security measure. It took awhile to work out opening the password protected file but finally this worked:
ShellExecute hwnd, "Open", strdbName, "", "C:\", 3
Sleep (700)
SendKeys "password", True
SendKeys "{ENTER}", True
 
IMO: I would avoid using the SendKeys function.
 
Had no choice. No other way to open the password protected ACCDR, unless someone else can come up with a better method. Using an ACCDE, some users can see all the items in the nav pane, while some users don't.
 
Had no choice. No other way to open the password protected ACCDR, unless someone else can come up with a better method. Using an ACCDE, some users can see all the items in the nav pane, while some users don't.

Yes, do NOT use SendKeys! I have a better way:

1. Create an ACCDE file. You can rename it ACCDR and get the extra benefits of it being compiled.

2. Open the other one like this:

Code:
Dim accApp As Access.Application
 
Set accApp = New Access.Application
 
accApp.OpenCurrentDatabase "YourFilePathAndNameHere", , "YourPasswordHere"
 
accApp.Visible
 
accApp.UserControl = True
 
Set accApp = Nothing
 
Nope, that won't work. I tired that before and the err message is:
"...can't open the database because it is missing or opened exclusive by another user, or it is not an ADP file".

That won't work on ACCDR files, though it does an ACCDE.


Also get err on "invalid use of property " on
accApp.Visible
It has to be addapp.visible = true
 
Hello
How do I write and declare this code in VBA:
Code:
ShellExecute hwnd, "Open", strdbName, "", "C:\", 3
Sleep (700)
SendKeys "password", True
SendKeys "{ENTER}", True

Thanks

Bruno
 
1. Compiling to .accde and THEN renaming to .accdr is probably the best solution for distrubution.
2. I'm not sure why one database is opening another. Are you trying to do automation? The preferred method if you want to secure an app is to have the user log in using a log in form rather than prompting for a password.
 
Hello Pat,
I need open another external database ".ACCDR"
Thanks

Bruno Gordino
 
Open for what purpose? Are you doing automation? Otherwise, you can just let the user log in.
 

Users who are viewing this thread

Back
Top Bottom