Hello all Experts,
I'm using the following function to hide the access background, the problem I'm experiencing is that although it works well with forms, reports open but are not displayed, in other words access freezes.
Here is the code:
I call the function in the On Open event of the startup form like this: Call fSetAccessWindow(0)
Attached is a sample file that illustrates the issue, just open any report.
I'm using the following function to hide the access background, the problem I'm experiencing is that although it works well with forms, reports open but are not displayed, in other words access freezes.
Here is the code:
Code:
Option Explicit
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Function fSetAccessWindow(nCmdShow As Long)
Dim loX As Long
Dim loForm As Form
Dim loReport As Report
On Error Resume Next
Set loForm = Screen.ActiveForm
Set loReport = Screen.ActiveReport
If Err <> 0 Then
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Or _
nCmdShow = SW_SHOWMINIMIZED And loReport.Modal = True _
Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Or _
nCmdShow = SW_HIDE And loReport.PopUp <> True _
Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
fSetAccessWindow = (loX <> 0)
End Function
Attached is a sample file that illustrates the issue, just open any report.