Starting Access Maximized

N

Novice

I have created a database with a form that comes up as an
initial menu. Unfortunately, the form isn't maximized
inside Access, but is windowed.

I have noticed that whenever the database window is
maximized, the form will maximize too.

How can I default Access to start Maximized?

Sorry this may sound simple, but I'm a simple guy.

Thanks for any help.
 
W

Wayne Morgan

Right click the shortcut to Access, choose Properties, on the Short Cut tab
go to Run and change Normal Window to Maximized.

You could also do this in the form's Load event. I just tried the following
code from the API Guide distributed by AllAPI.Net and it worked. There may
be more here than is necessary, I haven't gone through it to see if any of
it can be removed.

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
'these 2 lines probably aren't needed just to maximize the Access
window
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 (minimized)
rtn = SetWindowPlacement(Application.hWndAccessApp, WinEst)

'Now maximize the form
DoCmd.Maximize

End Sub
 
J

Jim/Chris

To open up the application in maximized mode
in a macro
Action: RunCommand
Command: AppMaximize

In code
DoCmd.RunCommand acCmdAppMaximize

Jim
 
R

Rick Brandt

This was my original question. How do I get it to default
to Maximized?

In the OpenEvent of your form have code...

DoCmd.Maximize.

This will not maximize Access on your desktop, but will maximize the form
within the Access window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top