473,471 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Miinimize the Access Application window

6 New Member
I want to minimize the Access Application by a button click. However, docmd.runcommand accmdappminimize is not working and DoCmd.minimize is work just to minimize the forms.
Jun 7 '18 #1

✓ answered by twinnyfo

681212,

Welcome to Bytes!

The easiest way I can assist is to simply provide a Function that I use all the time. You can put this in a new module:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. '==============================
  5. '  CONSTANTS FOR DBASE WINDOW
  6. '==============================
  7.  
  8. Private Const DB_Hide = 0
  9. Private Const DB_Normal = 1
  10. Private Const DB_Minimized = 2
  11. Private Const DB_Maximized = 3
  12.  
  13.  
  14. '==========================
  15. '  DBASE WINDOW FUNCTIONS
  16. '==========================
  17.  
  18. Public Declare Function IsWindowVisible Lib "user32" _
  19.     (ByVal hwnd As Long) _
  20.     As Long
  21.  
  22. Public Declare Function ShowWindow Lib "user32" _
  23.     (ByVal hwnd As Long, _
  24.     ByVal nCmdShow As Long) _
  25.     As Long
  26.  
  27. '============================
  28. ' FORM MANAGEMENT FUNCTIONS
  29. '============================
  30.  
  31. Public Function fAccessWindow( _
  32.     Optional Procedure As String, _
  33.     Optional SwitchStatus As Boolean, _
  34.     Optional StatusCheck As Boolean) As Boolean
  35. '***********************************************************************************
  36. '* Purpose:  Controls the behavior and appearance of the Database Window            *
  37. '* Accepts:  Procedure    - (Optional) Describes the behavior requested            *
  38. '*           SwitchStatus - (Optional) Instructs the procedure to switch the       *
  39. '*                          current status of the DB Window                        *
  40. '*           StatusCheck -  (Optional) Allows the procedure to check the current   *
  41. '*                          status of the DB window to determine whether or not to *
  42. '*                          initiate a change                                      *
  43. '***********************************************************************************
  44. On Error GoTo EH
  45.     Dim dwReturn As Long
  46.  
  47.     Select Case Procedure
  48.         Case "Hide"
  49.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
  50.         Case "Minimize"
  51.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Minimized)
  52.         Case "Normal"
  53.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Normal)
  54.         Case "Show"
  55.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
  56.     End Select
  57.  
  58.     If SwitchStatus = True Then
  59.         If IsWindowVisible(hWndAccessApp) = 1 Then
  60.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
  61.         Else
  62.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
  63.         End If
  64.     End If
  65.  
  66.     If StatusCheck = True Then
  67.         If IsWindowVisible(hWndAccessApp) = 0 Then
  68.             fAccessWindow = False
  69.         End If
  70.  
  71.         If IsWindowVisible(hWndAccessApp) = 1 Then
  72.             fAccessWindow = True
  73.         End If
  74.     End If
  75.  
  76.     Exit Function
  77. EH:
  78.     MsgBox "There was an error resetting the Database Window!  " & _
  79.         "Please contact your Database Administrator.", vbCritical, "WARNING!"
  80.     Exit Function
  81. End Function
To call this Function, just use this statement in your VBA:

Expand|Select|Wrap|Line Numbers
  1. fAccessWindow "Minimize"
Hope this hepps!

2 2558
twinnyfo
3,653 Recognized Expert Moderator Specialist
681212,

Welcome to Bytes!

The easiest way I can assist is to simply provide a Function that I use all the time. You can put this in a new module:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. '==============================
  5. '  CONSTANTS FOR DBASE WINDOW
  6. '==============================
  7.  
  8. Private Const DB_Hide = 0
  9. Private Const DB_Normal = 1
  10. Private Const DB_Minimized = 2
  11. Private Const DB_Maximized = 3
  12.  
  13.  
  14. '==========================
  15. '  DBASE WINDOW FUNCTIONS
  16. '==========================
  17.  
  18. Public Declare Function IsWindowVisible Lib "user32" _
  19.     (ByVal hwnd As Long) _
  20.     As Long
  21.  
  22. Public Declare Function ShowWindow Lib "user32" _
  23.     (ByVal hwnd As Long, _
  24.     ByVal nCmdShow As Long) _
  25.     As Long
  26.  
  27. '============================
  28. ' FORM MANAGEMENT FUNCTIONS
  29. '============================
  30.  
  31. Public Function fAccessWindow( _
  32.     Optional Procedure As String, _
  33.     Optional SwitchStatus As Boolean, _
  34.     Optional StatusCheck As Boolean) As Boolean
  35. '***********************************************************************************
  36. '* Purpose:  Controls the behavior and appearance of the Database Window            *
  37. '* Accepts:  Procedure    - (Optional) Describes the behavior requested            *
  38. '*           SwitchStatus - (Optional) Instructs the procedure to switch the       *
  39. '*                          current status of the DB Window                        *
  40. '*           StatusCheck -  (Optional) Allows the procedure to check the current   *
  41. '*                          status of the DB window to determine whether or not to *
  42. '*                          initiate a change                                      *
  43. '***********************************************************************************
  44. On Error GoTo EH
  45.     Dim dwReturn As Long
  46.  
  47.     Select Case Procedure
  48.         Case "Hide"
  49.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
  50.         Case "Minimize"
  51.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Minimized)
  52.         Case "Normal"
  53.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Normal)
  54.         Case "Show"
  55.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
  56.     End Select
  57.  
  58.     If SwitchStatus = True Then
  59.         If IsWindowVisible(hWndAccessApp) = 1 Then
  60.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
  61.         Else
  62.             dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
  63.         End If
  64.     End If
  65.  
  66.     If StatusCheck = True Then
  67.         If IsWindowVisible(hWndAccessApp) = 0 Then
  68.             fAccessWindow = False
  69.         End If
  70.  
  71.         If IsWindowVisible(hWndAccessApp) = 1 Then
  72.             fAccessWindow = True
  73.         End If
  74.     End If
  75.  
  76.     Exit Function
  77. EH:
  78.     MsgBox "There was an error resetting the Database Window!  " & _
  79.         "Please contact your Database Administrator.", vbCritical, "WARNING!"
  80.     Exit Function
  81. End Function
To call this Function, just use this statement in your VBA:

Expand|Select|Wrap|Line Numbers
  1. fAccessWindow "Minimize"
Hope this hepps!
Jun 7 '18 #2
681212
6 New Member
Wonderful.. Thanks Twinnyfo
Jun 7 '18 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Henrik | last post by:
How do you access another window? For example if u whant tpo write something in a textbox in an other opwn window?
3
by: MLH | last post by:
I seem to remember a post in the distant past discussing how to switch to another open application window. IE, if WordPad is running, some API function that'll allow me to switch the focus to that...
1
by: Iwer M?rck | last post by:
Hi How can I move and resize then access application window from within VBA? Best regards Iwer Mørck
0
by: lauren quantrell | last post by:
I have an Access 2000 application and I am using ShowWindow to hide the MS Access application window. Works fine as long as there is a popup form open all the time. The problem is when I want to...
9
by: Max | last post by:
Hello, Using VB.NET, I can activate an application by entering: AppActivate(intProcessID), where intProcessID is the process ID of a running application. Is it possible to set the size and...
3
by: wavedave | last post by:
Hello everyone - I'm trying to build a .NET application (C#) in which my program acts as an add-on to another existing application, providing some additional functionality. The way I want the UI...
3
by: VANWEB | last post by:
A developer gave me a Microsoft Access Application approximately 42MB that I had him design. I can open the application itself and see the Access GUI with the buttons & menu he created, but I...
3
by: x taol | last post by:
Private Declare Function GetSystemMenu Lib "user32.dll" (ByVal Hwnd As Long, ByVal bRevert As Long) As Long Private Declare Function DeleteMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal...
0
by: x taol | last post by:
i have the two access window application. A will handle the B between A access and B access. i want to know state of B from A. for example, currently the B is minimized or maximized and so on........
1
by: WackoZacho | last post by:
I've tried searching on Google and for other questions similar to mine, but all I get are results on how to use the LostFocus event or Deactivate, etc., but I'm under the impression each of these...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.