I want to open an external password protected database in separate window. I have tried follwoing code (shared by Isladogs from MendipDataSystems on some forum):
Public Function RunExternalDatabase() As Boolean
Dim app As Access.Application, strPath As String
'Start a new MSAccess application
Set app = New Access.Application
'Open the remote database and run a macro, then close the remote database
With app
'Syntax: .OpenCurrentDatabase(filepath, Exclusive, strPassword) - the last 2 items are optional
strPath = "C:\Programs\MendipDataSystems\JATFA\JATFA.accdb" 'replace with your file path
.OpenCurrentDatabase strPath, True, "password"
' .DoCmd.RunMacro "mcrRefreshPersTable" 'run your macro
.CloseCurrentDatabase 'closes external database as that is current
End With
'Quit the spawned app
app.Quit acQuitSaveNone
Set app = Nothing
'Quit the current app - optional
Application.Quit acQuitSaveNone
End Function
Above code works fine in full Access but gives error for those users who are using Access runtime version. The line of code that gives error is Set App = New Access.Application.
How can I fix it OR is there any alternative method to get the purpose done?
Purpose is to open the password encrypted database in separate window in Access runtime version without entering the password manually.
Best Regards