Access is an MDI (Multiple Document Interface) application, and this is how they work: either all sub-windows are maximized, or none.
What you need to do, is find a way to discover the dimensions of the Access application window, and then programmatically set the form's .InsideWidth and .InsideHeight properties. The Application object has a hwndAccessApp that probably can be used with some Windows API call to find out its width and height.
addendum
Thanks to Philippe Grondier for finding a relevant code sample, the general idea from the code sample is:
- declare the following Win32 API elements:
struct Rect (Type Rect… in VBA)
const SW_SHOWNORMAL = 1 (for ShowWindow)
GetParent (given a hwnd, get its parent's hwnd)
GetClientRect (retrieve position and size from a hwnd)
IsZoomed (boolean; true if window is maximized)
ShowWindow (change the state of a window)
MoveWindow (to change the position and size of a window)
- if your form is maximized (
IsZoomed(frm.hWnd) = True), then restore it (ShowWindow frm.hWnd, SW_SHOWNORMAL)
- get the MDI clients area from your form's hWnd (
GetClientRect GetParent(frm.hWnd, rect))
- use the rect data to change the position and size of your window (
MoveWindow frm.hWnd, 0, 0, rect.x2-rect.x1, rect.y2-rect.y1)
(The above is basically the explanation of the code sample; I didn't copy-paste the code because I wasn't sure if the author allowed it).