As far as I know, the only option is to use the Windows API
Put this in your declarations:
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const SW_MAXIMIZE = 3
Private Const SW_NORMAL = 1
Then do something like this:
Sub OpenReport
dim hWnd as long
Set objAccess = CreateObject("Access.Application"
objAccess.OpenCurrentDatabase ("C:\..."
hWnd = FindWindow("OMain", "Microsoft Access"
If hWnd <> 0 Then
ShowWindow hWnd, SW_NORMAL
ShowWindow hWnd, SW_MAXIMIZE
End If
objAccess.DoCmd.OpenReport "rptMonthlyConsumptions", acViewPreview
objAccess.DoCmd.Maximize
I did have some problems setting some properties after using the ShowWindow function, so if you need to set any other properties, you may want to do that before calling the api functions.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.