ACC: How to Minimize, Maximize, and Restore MS Access (1.x/2.0) (89597)



The information in this article applies to:

  • Microsoft Access 1.0
  • Microsoft Access 1.1
  • Microsoft Access 2.0

This article was previously published under Q89597

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

To maximize, minimize, and restore Microsoft Access, you can use Microsoft Windows application programming interface (API) calls in Microsoft Access modules. Microsoft Access does not provide a function to perform these actions in a module or macro.

MORE INFORMATION

Once you define the following sample functions in a module, you can use them in macros as RunCode actions. To define the functions, follow these steps:
  1. From the File menu, choose New, and then Module. In the Declarations section add both of the following declarations:

    NOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

    Option Explicit
          Declare Function GetActiveWindow% Lib "User" ()
          Declare Function ShowWindow% Lib "User" (ByVal hWnd%,_
                                                   ByVal nCmdShow%)
    						
  2. Create the function MaximizeAccess():

          Function MaximizeAccess ()
             Dim ActiveWnd%, Maxit%
             ActiveWnd% = GetActiveWindow()
             Maxit% = ShowWindow(ActiveWnd%, 3)
          End Function
    						
  3. Create the function MinimizeAccess():

          Function MinimizeAccess ()
             Dim ActiveWnd%, Minit%
             ActiveWnd% = GetActiveWindow()
             Minit% = ShowWindow(ActiveWnd%,2)
          End Function
    						
  4. Create the function RestoreAccess():

          Function RestoreAccess ()
             Dim ActiveWnd%, Restoreit%
             ActiveWnd% = GetActiveWindow()
             Restoreit% = ShowWindow(ActiveWnd%, 1)
          End Function
    						
  5. The following sample macro action minimizes the Microsoft Access window:

          Action       FunctionName
          -----------------------------
          RunCode      MinimizeAccess()
    						

REFERENCES

For an example of how to maximize, minimize, and restore Microsoft Access in Microsoft Access for Windows 95 version 7.0 and Microsoft Access 97, please see the following article in the Microsoft Knowledge Base:

148834 ACC: How to Minimize, Maximize, and Restore MS Access 95/97

"Microsoft Windows Software Development Kit," Microsoft Press, 1992

"Programming Windows: the Microsoft Guide to Writing Applications for Windows 3," Charles Petzold. Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to Programming Reference" Volumes 1-6, Microsoft Press, 1992

Modification Type:MajorLast Reviewed:5/9/2003
Keywords:kbhowto kbprogramming KB89597