OpenCurrentDatabase Silently Fails On Laptop With Both Desktop and WebApp Versions of Access Installed RRS feed

  • Question

  • The following code works great on my desktop but not on a touchscreen laptop:

    Option Compare Database
    Option Explicit
    Private Sub TestOpenDatabase()
        Dim appAccess As Access.Application
        Set appAccess = New Access.Application
        appAccess.Visible = True
        appAccess.OpenCurrentDatabase "C:\Databases\Test.accdb"
    End Sub

    It successfully instantiates the new Access.Application object, but it silently fails to open the database.  The new application instance stays on the new database template selection screen.

    I believe that Access is instantiating a "WebApp" version of the application even though my code is running in the standard desktop version. 

    • The new Access instance appears in its own group on the taskbar
    • Task Manager indicates the file path of the MSACCESS.EXE is different:
    • Manually Opened Instances: C:\Program Files (x86)\Microsoft Office\Office16
    • Programmatically Opened Instances: C:\Program Files\WindowsApps\Microsoft.Office.Desktop.Access_16010.9126.2116.0_x86__8wekyb3d8bbwe\Office16

    The Web App version seems to be a sandboxed version of Access? Or maybe it's a Windows Store version of the Access that is optimized for touchscreen computers?  This code has worked fine on many machines, but this is the first touchscreen computer I've tried it on. Whatever the case,  it doesn't want to play ball with an external VBA process. 

    How can I force "New Access.Application" to create an instance of the standard desktop version of the app?

    • Edited by Jonathan Skarda Thursday, April 5, 2018 3:48 AM Unintended Markup removed
    Thursday, April 5, 2018 3:46 AM


  • Solved it. The solution is to set the Windows file type associations for Access files (*.accdb, etc) to the desktop version of the app.  The icons look a little different.

    It's disappointing that the Windows Store instance of Access doesn't throw any errors to the controlling application when failing to open a database file.

    Thursday, April 5, 2018 4:22 AM