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.
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: - Option Compare Database
-
Option Explicit
-
-
'==============================
-
' CONSTANTS FOR DBASE WINDOW
-
'==============================
-
-
Private Const DB_Hide = 0
-
Private Const DB_Normal = 1
-
Private Const DB_Minimized = 2
-
Private Const DB_Maximized = 3
-
-
-
'==========================
-
' DBASE WINDOW FUNCTIONS
-
'==========================
-
-
Public Declare Function IsWindowVisible Lib "user32" _
-
(ByVal hwnd As Long) _
-
As Long
-
-
Public Declare Function ShowWindow Lib "user32" _
-
(ByVal hwnd As Long, _
-
ByVal nCmdShow As Long) _
-
As Long
-
-
'============================
-
' FORM MANAGEMENT FUNCTIONS
-
'============================
-
-
Public Function fAccessWindow( _
-
Optional Procedure As String, _
-
Optional SwitchStatus As Boolean, _
-
Optional StatusCheck As Boolean) As Boolean
-
'***********************************************************************************
-
'* Purpose: Controls the behavior and appearance of the Database Window *
-
'* Accepts: Procedure - (Optional) Describes the behavior requested *
-
'* SwitchStatus - (Optional) Instructs the procedure to switch the *
-
'* current status of the DB Window *
-
'* StatusCheck - (Optional) Allows the procedure to check the current *
-
'* status of the DB window to determine whether or not to *
-
'* initiate a change *
-
'***********************************************************************************
-
On Error GoTo EH
-
Dim dwReturn As Long
-
-
Select Case Procedure
-
Case "Hide"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
-
Case "Minimize"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Minimized)
-
Case "Normal"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Normal)
-
Case "Show"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
-
End Select
-
-
If SwitchStatus = True Then
-
If IsWindowVisible(hWndAccessApp) = 1 Then
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
-
Else
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
-
End If
-
End If
-
-
If StatusCheck = True Then
-
If IsWindowVisible(hWndAccessApp) = 0 Then
-
fAccessWindow = False
-
End If
-
-
If IsWindowVisible(hWndAccessApp) = 1 Then
-
fAccessWindow = True
-
End If
-
End If
-
-
Exit Function
-
EH:
-
MsgBox "There was an error resetting the Database Window! " & _
-
"Please contact your Database Administrator.", vbCritical, "WARNING!"
-
Exit Function
-
End Function
To call this Function, just use this statement in your VBA:
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: - Option Compare Database
-
Option Explicit
-
-
'==============================
-
' CONSTANTS FOR DBASE WINDOW
-
'==============================
-
-
Private Const DB_Hide = 0
-
Private Const DB_Normal = 1
-
Private Const DB_Minimized = 2
-
Private Const DB_Maximized = 3
-
-
-
'==========================
-
' DBASE WINDOW FUNCTIONS
-
'==========================
-
-
Public Declare Function IsWindowVisible Lib "user32" _
-
(ByVal hwnd As Long) _
-
As Long
-
-
Public Declare Function ShowWindow Lib "user32" _
-
(ByVal hwnd As Long, _
-
ByVal nCmdShow As Long) _
-
As Long
-
-
'============================
-
' FORM MANAGEMENT FUNCTIONS
-
'============================
-
-
Public Function fAccessWindow( _
-
Optional Procedure As String, _
-
Optional SwitchStatus As Boolean, _
-
Optional StatusCheck As Boolean) As Boolean
-
'***********************************************************************************
-
'* Purpose: Controls the behavior and appearance of the Database Window *
-
'* Accepts: Procedure - (Optional) Describes the behavior requested *
-
'* SwitchStatus - (Optional) Instructs the procedure to switch the *
-
'* current status of the DB Window *
-
'* StatusCheck - (Optional) Allows the procedure to check the current *
-
'* status of the DB window to determine whether or not to *
-
'* initiate a change *
-
'***********************************************************************************
-
On Error GoTo EH
-
Dim dwReturn As Long
-
-
Select Case Procedure
-
Case "Hide"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
-
Case "Minimize"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Minimized)
-
Case "Normal"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Normal)
-
Case "Show"
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
-
End Select
-
-
If SwitchStatus = True Then
-
If IsWindowVisible(hWndAccessApp) = 1 Then
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Hide)
-
Else
-
dwReturn = ShowWindow(Application.hWndAccessApp, DB_Maximized)
-
End If
-
End If
-
-
If StatusCheck = True Then
-
If IsWindowVisible(hWndAccessApp) = 0 Then
-
fAccessWindow = False
-
End If
-
-
If IsWindowVisible(hWndAccessApp) = 1 Then
-
fAccessWindow = True
-
End If
-
End If
-
-
Exit Function
-
EH:
-
MsgBox "There was an error resetting the Database Window! " & _
-
"Please contact your Database Administrator.", vbCritical, "WARNING!"
-
Exit Function
-
End Function
To call this Function, just use this statement in your VBA:
Hope this hepps!
Wonderful.. Thanks Twinnyfo
Sign in to post your reply or Sign up for a free account.
Similar topics
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?
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
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........
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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...
|
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 ...
| |