Open Access date with hyperlink and maximize application window (1 Viewer)

bruceblack

Registered User.
Local time
Today, 23:39
Joined
Jun 30, 2017
Messages
119
Hey guys! Would be great if i can manage this little problem.
Which is annoying for the "dummy" guest users :p

Im opening Access from another database through a hyperlink.
(yes! this needs to be done in my case)

It closes the database and opens the "other" database (Expd 2016).

I want Expd 2016 to open maximized! Not the form, but the application itself. Problem is my forms are not centered because the application starts minimized.

I tried the following using vbMaximizedFocus but gives me runtime error 7971:

Code:
Private Sub Form_Load()

If Application.Version = "16.0" Then
   Application.FollowHyperlink "P:\Expd 2016.accdb", vbMaximizedFocus
    DoCmd.Quit
    'RunExternalDatabase
    Else
End If

End Sub
 

Minty

AWF VIP
Local time
Today, 23:39
Joined
Jul 26, 2013
Messages
10,355
Try this as an alternative approach;
Code:
    Dim appAcc       As Access.Application

    Set appAcc = New Access.Application
    appAcc.Visible = True

    appAcc.OpenCurrentDatabase ("P:\Expd 2016.accdb")       [COLOR="Green"]'(strSourcePath & strSourceFile) ' I set a string and path from a table rather than hard coded...
    [/COLOR]appAcc.UserControl = True
    appAcc.RunCommand acCmdAppMaximize
 

bruceblack

Registered User.
Local time
Today, 23:39
Joined
Jun 30, 2017
Messages
119
Thanks for your reply! :)

I tried it:

- It does open the database and it closes the other one.
- It does not focus on the database (as in its in the background)
- The database opens, but does not continue to load. I have a splash screen that has a 3 second hold on it, and it doesnt work anymore. It does when i open the file directly.

:confused: Is there NO way of just opening it maximized with my code?
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 07:39
Joined
May 7, 2009
Messages
19,169
here is the code you need to build on your form.
if possible Dont use space on your database file.


Code:
Private Sub Form_Load()
    CloseCurrentDatabase
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Shell SysCmd(acSysCmdAccessDir) & "msaccess.exe P:\Expd2016.accdb", vbMaximizedFocus
    DoCmd.Quit
End Sub
 

isladogs

MVP / VIP
Local time
Today, 23:39
Joined
Jan 14, 2017
Messages
18,186
Bruce

I thought you were abandoning this idea after the previous lengthy thread....
 

Mark_

Longboard on the internet
Local time
Today, 16:39
Joined
Sep 12, 2017
Messages
2,111
@ Bruce,

In your splash screen, can you have it run
Code:
DoCmd.RunCommand acCmdAppMaximize
To set itself to maximized?
 

Minty

AWF VIP
Local time
Today, 23:39
Joined
Jul 26, 2013
Messages
10,355
Just to revisit this as well, I assumed you were closing the calling database once you had opened the calling database?

Unless you set the newly opened database as the active window it will be in the background.
You can do that by using something like;
Code:
AppActivate CurrentDb.Properties("AppTitle").Value
In the form that opens in the target database
 

Users who are viewing this thread

Top Bottom