Share via

Open MS-Access encrypted database in Runtime version with UserControl false

Anonymous
2017-11-24T16:04:29+00:00

I work with Access runtime version and I need to open an encrypted database .accdb. I created a dummy file to work with getobject and opencurrentdatabase statement. I can't work with CreateObject("Access.Application") or new access.application because this is the runtime version.

My code is this, and works fine but when I open the encrypted database the UserControl property is false, and it opens whith any access message like docm.setwarnings in false and "docm.setwarnings true" doesn't work.

Dim appRT As Object

Public Sub OpenEncryptDb()
Const Q As String = """"

strPathEncryptDb = CurrentProject.Path & "\encryptdb.accdb"
strPathToDummy2 = CurrentProject.Path & "\dummy.accdb"
strPathToRuntime = SysCmd(acSysCmdAccessDir) & "msaccess.exe"

Shell Q & strPathToRuntime & Q & " /RUNTIME " & Q & strPathToDummy2 & Q, vbNormalFocus

Set appRT = GetObject(strPathToDummy2)
With appRT
    .CloseCurrentDatabase
    .OpenCurrentDatabase strPathEncryptDb, False, "123456" 'open encrypt database
    .DoCmd.RunCommand acCmdAppMaximize
End With
End Sub

I shared the code in this link

https://1drv.ms/u/s!AsgXxStf7QGagQZIk8hcJShbCIye

open  first the master.accdb file. Note that when you open the final file "encryptdb.accdb", you can delete rows and you don't receive any  confirmation message that regularly you receive when you delete rows in MS-Access like "master.accdb"

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2017-12-11T22:02:08+00:00

    Thank you for your answer,

    Execute Shell() with the /runtime switch and full ms-access version is equal that execute shell() with only ms-access runtime version installed in the pc. If you have ms-access full version installed the final database works fine without /runtime switch, because it make an object of ms-access.

    When you install only ms-access runtime version in your machine, without full version of ms-access, you receive same error  without /runtime switch in Shell().

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-12-11T21:32:05+00:00

    I had lost track of this question while waiting for the clarification I asked for, but I finally had a chance to look at the posted databases.

    The problem seems to be caused by the /runtime switch, or runtime mode itself.  I find that if I remove that switch from the command-line that is executed via Shell(), the secondary database works as expected, with the normal warnings being displayed.  The .UserControl property can't be set, but it turns out that's okay because the second instance of Access isn't created by automation, so .UserControl is already True.

    I tried to find a way to make it work properly while specifying the /runtime switch, but was unable to do so.  I don't have the Access runtime installed, so I can't swear that its behavior under the runtime module would be the same as when the /runtime command-line switch is specified; of course, it's supposed to be, but I can't test that.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-11-29T14:30:12+00:00

    excuse me some else linked it in  another thread, i edit the original question

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2017-11-25T12:13:34+00:00

    We prefer that you not piggyback your question on someone else's thread. So your question was split from the older thread you posted to. Please provide the code you are using and a fuller explanation of the problem so we can help.

    Please note that an accdr file is meant to run as if it was being run using the Runtime version of Access. Therefore, design elements are not accessible.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2017-11-24T21:56:44+00:00

    I'm sorry, but I don't understand your question.  Could you please ask it again with different phrasing?

    Was this answer helpful?

    0 comments No comments