Microsoft KB Archive/210090

= ACC2000: How to Use Visual Basic for Applications to Minimize, Maximize, and Restore Access =

Article ID: 210090

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210090



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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
This article shows you how to use Visual Basic for Applications code to maximize, minimize, and restore Access.

You can use the RunCommand action to maximize, minimize, and restore Access. For example, you can use the following: DoCmd.RunCommand acCmdAppMaximize DoCmd.RunCommand acCmdAppMinimize DoCmd.RunCommand acCmdAppRestore If you are using Automation, you can use the following: application.DoCmd.RunCommand acCmdAppMaximize application.DoCmd.RunCommand acCmdAppMinimize application.DoCmd.RunCommand acCmdAppRestore



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. You can also write Visual Basic for Applications functions that use Windows API calls to maximize, minimize, and restore the current Application window. To see an example of this, follow these steps:  In a new Access database, click Modules, and then click New. The Visual Basic Editor appears.  Type or paste the following code: 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

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

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

Function RestoreApp Dim Restoreit% Restoreit% = ShowWindow(hWndAccessApp, SW_SHOWNORMAL) End Function  Save the module, and then close the Visual Basic Editor.  Create a new form called MyForm, and then create the following command button:   Command button Name: MinAcc Caption: Minimize Access OnClick: =MinimizeApp  Save the form, and then open the form in Form view. Click the Minimize Access button to see Access minimized.</li></ol>

Keywords: kbhowto kbinfo kbprogramming KB210090

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.