ACCDR vba open with password (1 Viewer)

beachldy

Registered User.
Local time
Today, 00:46
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?
 

SteveSchapel

Registered User.
Local time
Today, 16:46
Joined
Apr 29, 2010
Messages
242
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.
 

beachldy

Registered User.
Local time
Today, 00:46
Joined
Jun 22, 2010
Messages
27
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
 

ghudson

Registered User.
Local time
Today, 00:46
Joined
Jun 8, 2002
Messages
6,195
IMO: I would avoid using the SendKeys function.
 

beachldy

Registered User.
Local time
Today, 00:46
Joined
Jun 22, 2010
Messages
27
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.
 

SOS

Registered Lunatic
Local time
Yesterday, 21:46
Joined
Aug 27, 2008
Messages
3,517
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
 

beachldy

Registered User.
Local time
Today, 00:46
Joined
Jun 22, 2010
Messages
27
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
 

brunogor

New member
Local time
Today, 05:46
Joined
Jan 15, 2014
Messages
2
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:46
Joined
Feb 19, 2002
Messages
43,263
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.
 

brunogor

New member
Local time
Today, 05:46
Joined
Jan 15, 2014
Messages
2
Hello Pat,
I need open another external database ".ACCDR"
Thanks

Bruno Gordino
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:46
Joined
Feb 19, 2002
Messages
43,263
Open for what purpose? Are you doing automation? Otherwise, you can just let the user log in.
 

Users who are viewing this thread

Top Bottom