Microsoft Access
--
Questions
--
Followers
Top Experts
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
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
this might be a useful wayout for u
(need to update ur code therein a bit)
hope u get results as expected :)
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).
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.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.

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.
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.a
Application.Quit
ExitHere:
Exit Sub
*******
You should post your own question for your issue. EE doesn't really allow you to "tag" onto other questions.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
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.