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

Last reviewed: August 28, 1997
Article ID: Q148834
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SUMMARY

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

Microsoft Access does not provide a function to maximize, minimize, and restore Microsoft Access from a module or macro. This article demonstrates how to use Microsoft Windows API calls in code to maximize, minimize, and restore Microsoft Access.

NOTE: In Microsoft Access 97, you can use the RunCommand to maximize, minimize and restore Microsoft Access. For example, you can use the following methods:

   DoCmd.RunCommand acCmdAppMaximize
   DoCmd.RunCommand acCmdAppMinimize
   DoCmd.RunCommand acCmdAppRestore

If you are using Automation, you can use the following methods:

   application.DoCmd.RunCommand acCmdAppMaximize
   application.DoCmd.RunCommand acCmdAppMinimize
   application.DoCmd.RunCommand acCmdAppRestore

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.

MORE INFORMATION

Once you define the following sample functions in a module, you can use them in macros as RunCode actions. To do so, follow these steps:

  1. On the Insert menu, click New, and then Module. Type the following lines in the Declarations section:

          Option Explicit
    

          Global Const SW_SHOWNORMAL = 1
          Global Const SW_SHOWMINIMIZED = 2
          Global Const SW_SHOWMAXIMIZED = 3
    

          Declare Function ShowWindow Lib "User32" (ByVal Hwnd As Long, _
    
              ByVal nCmdShow As Long) As Long
    
    

  2. Create the function MaximizeAccess():

          Function MaximizeAccess()
    
             Dim Maxit%
             Maxit% = ShowWindow(hWndAccessApp, SW_SHOWMAXIMIZED)
          End Function
    
    

  3. Create the function MinimizeAccess():

          Function MinimizeAccess()
    
             Dim Minit%
             Minit% = ShowWindow(hWndAccessApp, SW_SHOWMINIMIZED)
          End Function
    
    

  4. Create the function RestoreAccess():

          Function RestoreAccess()
    
             Dim Restoreit%
             Restoreit% = ShowWindow(hWndAccessApp, SW_SHOWNORMAL)
          End Function
    
    

  5. The following sample macro action will minimize the Microsoft Access window:

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

REFERENCES

For an example of how to minimize, maximize, and restore Microsoft Access version 2.0, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q89597
   TITLE:      ACC2: How to Minimize, Maximize, and Restore MS Access

Microsoft Access, "Building Applications with Microsoft Access 97," Chapter 12, "Using Library Databases and Dynamic-Link Libraries"

For more information about hWndAccessApp, search the Help Index for "hWndAccessApp," or ask the Microsoft Access 97 Office Assistant.


Additional query words: hWND Win32 API
Keywords : kbprg PgmApi
Version : 7.0 97
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.