I wish I could remember where I got the original code from so I could give credit where it's due. I simplified it for my needs. It's just a basic function...
Option Compare Database
Option Explicit
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
Dim dwReturn As Long
'Set up constant values
Const HIDE = 0
Const SHOWNORMAL = 1
Const SHOWMINIMIZED = 2
Const SHOWMAXIMIZED = 3
'Allows user to Maximize, Minimize, and Hide MSAccess enviornment window
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, HIDE)
End If
If Procedure = "Maximize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SHOWMINIMIZED)
End If
'Allows user to toggle whether MSAccess window is visible
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SHOWMAXIMIZED)
End If
End If
'Returns boolean value if MSAccess window is visible
If StatusCheck = True Then
If IsWindowVisible(hWndAccessApp) = 0 Then
fAccessWindow = False
End If
If IsWindowVisible(hWndAccessApp) = 1 Then
fAccessWindow = True
End If
End If
End Function