Launch Password Protected External Database for usage

MSingh
3StarLounger
Posts: 366
Joined: 12 May 2010, 06:49

Launch Password Protected External Database for usage

Post by MSingh »

Hi,

Please could you advise how i can open C:\MyFolder\Database1.accde (from cmdLaunchApp in the currently opened database).
C:\MyFolder\Database1.accde has the password:"password".

I have been trying the OpenDatabase method but realise that it does not launch the target database for end-user usage.

Your assistance would be greatly appreciated.

Kind Regards,
Mohamed

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Launch Password Protected External Database for usage

Post by HansV »

If you want to open Database1.accdb, replacing the currently open database, you can use:

Code: Select all

    Application.OpenCurrentDatabase "C:\MyFolder\Database1.accde", , "password"
Keep in mind that this will instantly close the current database, ending execution of the code in that database. If you want to open Database1.accde in another instance of Access, you can use

Code: Select all

    Dim app As Application
    Set app = CreateObject("Access.Application")
    app.UserControl = True
    app.OpenCurrentDatabase "C:\MyFolder\Database1.accde", , "password"
Best wishes,
Hans

MSingh
3StarLounger
Posts: 366
Joined: 12 May 2010, 06:49

Re: Launch Password Protected External Database for usage

Post by MSingh »

Thanks Hans,
Greatly appreciated.
Kind Regards,
Mohamed

MSingh
3StarLounger
Posts: 366
Joined: 12 May 2010, 06:49

Re: Launch Password Protected External Database for usage

Post by MSingh »

Hi Hans,

For some strange reason the password protected file: Database1.accde opens in an Access window that is not maximised.
I tried this on my desktop and laptop, on the laptop it opens in an even smaller window.

Could you suggest a solution ?

Kind Regards,
Mohamed

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Launch Password Protected External Database for usage

Post by HansV »

Try this:

Code: Select all

    Dim app As Application
    Set app = CreateObject("Access.Application")
    app.UserControl = True
    ' Maximize the Access window
    app.RunCommand acCmdAppMaximize
    app.OpenCurrentDatabase "C:\MyFolder\Database1.accde", , "password"
Best wishes,
Hans

MSingh
3StarLounger
Posts: 366
Joined: 12 May 2010, 06:49

Re: Launch Password Protected External Database for usage

Post by MSingh »

Excellent !
Many Thanks Hans.

Kind Regards,
Mohamed