A
Andy
Hi;
Have set the Frm's Min Max Buttons Properties to None
Close Button and Control Box Properties to No.
The Frm's OnOpen Event is Docmd.Maximize.
When the Frm opens the Restore button appears. (even when saved as an MDE)..
Don't want it.
Too likely that a user will click it and then move to areas they shouldn't
be.
Searched MSKB and found:, (Full Code Below)
210299 Maximized Form Shows Control Box and Minimize, Maximize, and Restore
Buttons
It does remove the Restore button but then the user has to use the scroll
bar to display the record selectors.
Would someone be so kind and point me in the correct direction?
Andy
Module Code:
1. Create a new module and type the following lines in the Declarations
section:
Type Rect
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, _
lpRect As Rect) As Long
Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal _
nCmdShow As Long) As Long
Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal _
X As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight _
As Long, ByVal bRepaint As Long) As Long
Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNORMAL = 1
2. Type the following Sub procedure in the module
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, SW_SHOWNORMAL
End If
' Get the screen coordinates and window size of the
' MDIClient window.
GetWindowRect 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 + 4, _
MDIRect.y2 - MDIRect.y1 + 4, True
End Sub
3. Set the OnLoad property of the form to the following event procedure:
Sub Form_Load()
MaximizeRestoredForm Me
End Sub
Have set the Frm's Min Max Buttons Properties to None
Close Button and Control Box Properties to No.
The Frm's OnOpen Event is Docmd.Maximize.
When the Frm opens the Restore button appears. (even when saved as an MDE)..
Don't want it.
Too likely that a user will click it and then move to areas they shouldn't
be.
Searched MSKB and found:, (Full Code Below)
210299 Maximized Form Shows Control Box and Minimize, Maximize, and Restore
Buttons
It does remove the Restore button but then the user has to use the scroll
bar to display the record selectors.
Would someone be so kind and point me in the correct direction?
Andy
Module Code:
1. Create a new module and type the following lines in the Declarations
section:
Type Rect
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, _
lpRect As Rect) As Long
Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal _
nCmdShow As Long) As Long
Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal _
X As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight _
As Long, ByVal bRepaint As Long) As Long
Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNORMAL = 1
2. Type the following Sub procedure in the module
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, SW_SHOWNORMAL
End If
' Get the screen coordinates and window size of the
' MDIClient window.
GetWindowRect 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 + 4, _
MDIRect.y2 - MDIRect.y1 + 4, True
End Sub
3. Set the OnLoad property of the form to the following event procedure:
Sub Form_Load()
MaximizeRestoredForm Me
End Sub