From: McHammer on
Hi everybody,
I want to minimize the access windows and have my forms only in modal popup
way, with the main forms always on the background. I just found and copied a
module (see below) that does it well except for a small side effect. I have
some "animated" buttons/labels (e.g. change font size/colour/picture etc. on
click/mouse move events) on a secondary form and, after an on click event,
the access window get back. Running the same command (e.g save record and
close secondary form) from a simple button created by access toolbox (no
focus on it), everything works and the access window remains minimezed. I'd
like to keep my buttons, but I don't know how to move around this problem.
Can someone help and explain me what's going on?

Thanks in advance

McHammer
Milan, Italy

Here below the module. I just call the function fSetAccessWindow
(SW_SHOWMINIMIZED) on form load event of the main form.

Option Compare Database
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
On Error Resume Next
Set loform = Screen.ActiveForm

If Err <> 0 Then
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
If nCmdShow = SW_SHOWMINIMIZED And loform.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loform.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loform.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