'--------------------------------------------------------------------------------------- ' Procedure : ReSizeForm ' DateTime : 27/01/2003 ' Author : Jamie Czernik ' Purpose : Routine should be called on a form's onOpen or onLoad event. '--------------------------------------------------------------------------------------- Public Sub ReSizeForm(ByVal frm As Access.Form) Dim rectWindow As tRect Dim lngWidth As Long Dim lngHeight As Long Dim sngVertFactor As Single Dim sngHorzFactor As Single On Error Resume Next sngVertFactor = getFactor(True) 'Local function returns vertical size change. sngHorzFactor = getFactor(False) 'Local function returns horizontal size change. Resize sngVertFactor, sngHorzFactor, frm 'Local procedure to resize form sections & controls. If WM_apiIsZoomed(frm.hwnd) = 0 Then 'Don't change window settings for max'd form. Access.DoCmd.RunCommand acCmdAppMaximize 'Maximize the Access Window. 'Store for dimensions in rectWindow:- Call WM_apiGetWindowRect(frm.hwnd, rectWindow) 'Calculate and store form height and width in local variables:- With rectWindow lngWidth = .right - .left lngHeight = .bottom - .Top End With 'Resize the form window as required (don't resize this for sub forms):- If frm.Parent.Name = VBA.vbNullString Then Call WM_apiMoveWindow(frm.hwnd, ((getScreenResolution.Width - _ (sngHorzFactor * lngWidth)) / 2) - getLeftOffset, _ ((getScreenResolution.Height - (sngVertFactor * lngHeight)) / 2) - _ getTopOffset, lngWidth * sngHorzFactor, lngHeight * sngVertFactor, 1) End If End If Set frm = Nothing 'Free up resources. End Sub