Link to home
Create AccountLog in
Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Avatar of anAppBuilder
anAppBuilder🇺🇸

Access 2010: Can I start an ACCDE in runtime mode and supply it's password?
I need to create a shortcut or bat file or vba code or something that starts an encrypted Access 2010 ACCDE  and

o Ensures that it runs in runtime mode even if the retail version of Access is running on the same machine
o Passes it's password to it so that the user does not need to enter a password

I know how to do either or, but not both.  See snippets in code below.


This in a .bat file will start it in runtime mode:
start "" "C:\Program Files\Microsoft Office\Office14\msaccess.exe" /runtime  "C:\Users\...\MyDB.accde" 

This in vba will pass a password:
' Make the encrypted DB the current DB.
    appAccess.Visible = True
    appAccess.UserControl = True 
    appAccess.OpenCurrentDatabase "C:\Users\...\MyDB.accde", False, "MyPwd"
    
This vba will test for not in runtime mode and stop the DB from running:
 If SysCmd(acSysCmdRuntime) = True Then
        MsgBox "Using Runtime...this is OK"
    Else
        MsgBox "This application must be run with the /runtime switch on"
    End If

Open in new window

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of RamanhpRamanhp🇮🇳

plz visit >> http://www.utteraccess.com/forum/Force-Access-run-runtim-t1434285.html

this might be a useful wayout for u
(need to update ur code therein a bit)

hope u get results as expected :)

AFAIK, there is no way to pass in a Database Password via a commandline. It can only be done through code, and since you cannot automate the Runtime, you really are stuck here.

You can eliminate the /runtime switch by simply changing the name from .accdE to .accdR. I realize this isn't in the doucmentation, but many people have done this with no ill effects, and it works. All the .accdR does is tell access to open in Runtime mode.

So, theoretically you could use your OpenCurrentDatabase VBA code to open your .accdR file, which would open in Runtime mode. This is generally done via a small launcher app (which would be little more than an Access or VB program that fires off that code you show earlier).


Avatar of anAppBuilderanAppBuilder🇺🇸

ASKER

Thank you, Ramanhp.  Unfortunately, the link you provided basically runs a command line from Access, so it has the same limitation on passing a password.  The password in that link is a module password, not a database password.

Thank you, LSM.  Use of an accdR theoretically should work.  Unfortunately in practice I get this message when I rename my accdb or accde to an accdr and run the code I put in above.  I hope I'm missing something obvious here.

Microsoft Access cannot open this file.
This file was converted to runtime mode by changing its file extension to .accdr.  This file will only open when Access is in runtime mode.  To open the file, either double-click it in Windows Explorer, open it by using a shortcut, or us the /runtime command line switch.  To modify the design of this database, rename it with an .accdb file extension, and then open it in Access.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of anAppBuilderanAppBuilder🇺🇸

ASKER

One more question.  Am I limiting my code options by launching from another Access DB?  If I were to write a launcher in VB.NET or C# or C++ or some other language would I be able to use other options that would let me both force runtime mode and pass in a database password?

ASKER CERTIFIED SOLUTION
Avatar of Markus FischerMarkus Fischer🇨🇭

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of anAppBuilderanAppBuilder🇺🇸

ASKER

Thank you, harfang.  You really are a genius.  I tested the solution in Access 2010 and it works just fine there.

Thanks for the kind words, I'm glad it worked! — (°v°)

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


I have been trying to accomplish the same solution as shown here. Some users will not have full Access version installed, but will only have Access2010 RT version.  When testing in Windows XP Mode of Windows Virtual PC (with only Access2010 RT version installed), I continue to get error:

Error 429: ActiveX component can't create object

Form_Form1.Form_Open



My code is as follows:

******
Private Sub Form_Open(Cancel As Integer)

    Dim strCmd As String
    Dim accRT As Access.Application
   
On Error GoTo HandleErr
     
    strCmd = """" & SysCmd(acSysCmdAccessDir) & "MSACCESS.exe"" /runtime" _
        & " C:\Program Files\test\dummy.accdb"
   
    Shell strCmd, vbHide
    Set accRT = GetObject("C:\Program Files\test\dummy.accdb")
    accRT.CloseCurrentDatabase
    accRT.OpenCurrentDatabase "C:\Program Files\test\MyProtectedDB.accdb", , "password"
   
    Application.Quit


ExitHere:
    Exit Sub
*******

SeaDogMariner,

You should post your own question for your issue. EE doesn't really allow you to "tag" onto other questions.

Thanks LSMConsulting.  I do have an issue opened (https://www.experts-exchange.com/questions/27676175/How-to-open-Access2010-passworded-db-via-vb-code-Works-for-Windows7-but-not-XP.html?anchorAnswerId=38088234#a38088234), but have been stalled a bit and so was looking for additional avenues.  Wasn't sure about tagging.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.