How to hide MS Access window

history

Egyptian Pharaoh
Local time
Today, 13:21
Joined
Jan 26, 2008
Messages
190
Hello Guys

How can I hide the Access window ?
I mean, is there a way to make my program open on the startup form directly without viewing the grey background of the Access ?
I'm using Access 2007

Thank you

waiting your reply
 
history

Under the "Tools" menu there is an option called "StartUp". You can specify a form (usually a custom or default switchboard) to open when the app starts. This is the easiest way. I would be surprised if you could not also code for this using VBA. You can also set the Database window to visible or not from StartUP controls. HTH!




ST4R,
 
Dear ST4RCUTTER,

Thank you for your care, but by your reply it will not hide
"the grey background of the Access window"

Thank you dear friend
 
hi history,

I do not have Access 2007 so I am not sure if the following will definitely work. I think it will more likely depend on your version of Windows as it involves and API call. This works on WinXP XP2 / Access 2003.

Put this in a standalone code module:
Code:
Option Compare Database
Option Explicit

'DECLARE FUNCTION PROTOTYPES FOR WINAPI
Private Declare Function apiShowWindow Lib "user32" _
    Alias "ShowWindow" (ByVal hwnd As Long, _
          ByVal nCmdShow As Long) As Long
'DECLARE GLOBAL CONSTANTS
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3

Function hideaccess()
    Forms(Forms.Count - 1).SetFocus
    fSetAccessWindow SW_SHOWMINIMIZED
End Function

Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
'       ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
'       ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
'       ?fSetAccessWindow(SW_HIDE)
'Normal window:
'       ?fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX  As Long
Dim loForm As Form
    On Error Resume Next
    Set loForm = Screen.ActiveForm
    If Err <> 0 Then 'no Activeform
      If nCmdShow = SW_HIDE Then
        MsgBox "Cannot hide Access unless " _
                    & "a form is on screen"
      Else
        loX = apiShowWindow(hWndAccessApp, nCmdShow)
        Err.Clear
      End If
    Else
        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
    End If
    fSetAccessWindow = (loX <> 0)
End Function

to use it, just put
Code:
 hideaccess()
in Form_Load of the form that you have chosen as the startup form.

If this does not work, you should still be looking at a function in the winAPI to get your result.

HTH,
Chris
 
Thanks a lot Dear ecawilkinson

I'll try and call you
 
It works

I just tried this and apart from having to use 'Call hideaccess' to call it from the OnLoad event it works brililantly in 2003. Just surveying my users now to see if they'd like it.
 
Ahhh yes...I misunderstood your question there. :rolleyes: That is a new one to me. Wish I could be more helpful but I'm sure some of the others can.
 

Users who are viewing this thread

Back
Top Bottom