MS Access Tips: Maximize MS Access Window

65

By msaccessmemento

Call this function in autoexec macro for example:

Function AccessMaximize()

AccessMaximize = ShowWindow(GetAccesshWnd(), SW_MAXIMIZE)

End Function

where GetAccesshWnd is defined by:

Function GetAccesshWnd()

Dim hWnd As Integer

Dim hWndAccess As Integer

' Get the handle to the currently active window.

hWnd = GetActiveWindow()

hWndAccess = hWnd

' Find the top window without a parent window.

While hWnd <> 0

hWndAccess = hWnd

hWnd = GetParent(hWnd)

Wend

GetAccesshWnd = hWndAccess

End Function

which uses these declarations:

Declare Function GetActiveWindow Lib "User32" () As Integer

Declare Function GetParent Lib "User32" (ByVal hWnd As Integer) As Integer

Declare Function ShowWindow% Lib "User32" (ByVal hWnd%, ByVal nCmdShow%)

Global Const SW_MAXIMIZE = 3

Global Const SW_SHOWNORMAL = 1

Global Const SW_SHOWMINIMIZED = 2

Comments

Daniel 8 months ago

Why not simply use:

Access.RunCommand acCmdAppMaximize

or

DoCmd.RunCommand acCmdAppMaximize

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    • No HTML is allowed in comments, but URLs will be hyperlinked
    • Comments are not for promoting your Hubs or other sites

    Please wait working