One way is to go to the properties of the shortcut you are using to launch
the app and set it's Run property to Maximized on the Shortcut tab.
The following code in the form's module will maximize the Access window and
the form window. The first part goes in the Declarations part of the form's
module, the last part is the form's Load event. It requires the use of
Windows API functions to maximize the Access window. You will find more
options for these here (
http://www.mvps.org/access/api/api0019.htm).
Option Compare Database
Option Explicit
Private Const SW_MINIMIZE = 6
Private Const SW_MAXIMIZE = 3
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type WINDOWPLACEMENT
Length As Long
Flags As Long
showCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long,
lpPoint As POINTAPI) As Long
Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As
Long, lpwndpl As WINDOWPLACEMENT) As Long
Private Declare Function SetWindowPlacement Lib "user32" (ByVal hwnd As
Long, lpwndpl As WINDOWPLACEMENT) As Long
Dim Rectan As RECT
Private Sub Form_Load()
'Tip submitted by pyp99 (
[email protected])
Dim WinEst As WINDOWPLACEMENT
Dim Punto As POINTAPI
Dim rtn As Long
WinEst.Length = Len(WinEst)
'get the current window placement
rtn = GetWindowPlacement(Application.hWndAccessApp, WinEst)
Rectan = WinEst.rcNormalPosition
'set the new min/max positions
Punto.X = 100
Punto.Y = 100
'initialize the structure
WinEst.Length = Len(WinEst)
WinEst.showCmd = SW_MAXIMIZE
WinEst.ptMinPosition = Punto
WinEst.ptMaxPosition = Punto
WinEst.rcNormalPosition = Rectan
'set the new window placement (maximized)
rtn = SetWindowPlacement(Application.hWndAccessApp, WinEst)
'now maximize the form
DoCmd.Maximize
End Sub