here is some code I picked up out there on the net
Just add this to the form
Option Compare Database
Option Explicit
Private Sub Form_Load()
Call MaximizeRestoredForm(Me)
End Sub
Sub MaximizeRestoredForm(f As Form)
Dim MDIRect As Rect
' If the form is maximized, restore it.
If IsZoomed(f.hwnd) <> 0 Then
ShowWindow f.hwnd, Max_SW_SHOWNORMAL
End If
' Get the screen coordinates and window size of the
' MDIClient area.
'This is the line which is different
GetClientRect GetParent(f.hwnd), MDIRect
' Move the form to the upper left corner of the MDIClient
' window (0,0) and size it to the same size as the
' MDIClient window.
MoveWindow f.hwnd, 0, 0, MDIRect.x2 - MDIRect.x1, MDIRect.y2 - MDIRect.y1, True
End Sub
Sub MinimizeRestoredForm(f As Form)
Dim MDIRect As Rect
' If the form is maximized, restore it.
If IsZoomed(f.hwnd) <> 0 Then
ShowWindow f.hwnd, Max_SW_SHOWNORMAL
End If
' Get the screen coordinates and window size of the
' MDIClient area.
'This is the line which is different
GetClientRect GetParent(f.hwnd), MDIRect
' Move the form to the upper left corner of the MDIClient
' window (0,0) and size it to the same size as the
' MDIClient window.
'MoveWindow F.hWnd, 0, 0, MDIRect.x2 - MDIRect.x2 / 4, MDIRect.y2 - MDIRect.y2 / 4, True
Dim lngWidth As Long
lngWidth = (Me.Width)
MoveWindow f.hwnd, 24, 24, MDIRect.x2 - MDIRect.x2 / 4, MDIRect.y2 - MDIRect.y2 / 4, True
End Sub
'*************************** Code End ************************
PaulF