Show only the form when opening the file (1 Viewer)

Batraul

Registered User.
Local time
Today, 18:08
Joined
Dec 15, 2014
Messages
13
Hi all!

I enclose a part of my project. I've taken out the table, query and so on.
Only the form.
What i want to do is to view only the form when entering the app. But if you open the file you could see a flash of the app before minimizing it. Very few, but you can see it. I've deleted some more code in the opening form that made the flashing a little bit longer.
My code for entering is the following:

Code:
Private Sub Form_Open(Cancel As Integer)
DoCmd.RunCommand acCmdAppMinimize
Call fSetAccessWindow(0)
End sub

And then in another module:

Code:
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

Anybody knows how can I avoid this flashing at start?

Thank you and Happy New Year!!
 

Attachments

  • test.zip
    1.2 MB · Views: 101

CJ_London

Super Moderator
Staff member
Local time
Today, 17:08
Joined
Feb 19, 2013
Messages
16,641
not tried myself, but have you tried using an autoexec macro to minimise the access window and then open your form.

Also, try renaming your file .accdr which will open as a runtime
 

Batraul

Registered User.
Local time
Today, 18:08
Joined
Dec 15, 2014
Messages
13
not tried myself, but have you tried using an autoexec macro to minimise the access window and then open your form.

Also, try renaming your file .accdr which will open as a runtime

It's the same. It appears the flashing window. With both.
I think it's impossible to avoid it.
Anyway, thank you CJ for the answer.
 

Users who are viewing this thread

Top Bottom