Hiding Access

Status
Not open for further replies.

pat_nospam

Registered User.
Local time
Today, 10:15
Joined
Oct 14, 2003
Messages
151
Hiding Access (application disappears!)

Well, I can get the first window to minimize appropriately, but clicking on buttons to go to other forms seems to make the entire application disappear. Occasionally, when I load the application, the whole application disappears as well (no minimizing or anything) - the only place it still shows up is in the Task List.

Any ideas?

I'm using this in my form:
--------
Private Sub Form_Open(Cancel As Integer)
SetAccessWindow (SW_HIDE)
End Sub
--------
Access 2002 SP2 & Windows XP using the following code and modules:

Option Compare Database

'Window modus const
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3

'Private function
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal windowModus As Long) As Long

Function SetAccessWindow(windowModus As Long)

Dim loX As Long
Dim currentForm As Form

On Error Resume Next

'Declaratie
Set currentForm = Screen.ActiveForm

If Err <> 0 Then
loX = apiShowWindow(hWndAccessApp, windowModus)
Err.Clear
End If

If windowModus = SW_SHOWMINIMIZED And currentForm.Modal = True Then
MsgBox "Cannot minimize Access with " & (currentForm.Caption + " ") & "form on screen"
ElseIf windowModus = SW_HIDE And currentForm.PopUp <> True Then
MsgBox "Cannot hide Access with " & (currentForm.Caption + " ") & "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, windowModus)
End If

SetAccessWindow = (loX <> 0)

End Function
 
Re: Hiding Access (application disappears!)

pat_nospam said:
I'm using this in my form:
--------
Private Sub Form_Open(Cancel As Integer)
SetAccessWindow (SW_HIDE)
End Sub
--------

Firstly, if you are going to post code can you please use the [CODE] and [/CODE] tags to make it more legible? Thanks.

Now, the code you have is application specific. You are using the Windows API (functions written for Windows itself to use) within your database. That's why when you hide the Access window it really is hidden - the window you are hiding is the actual instance of Access that you have open.

I get the impression that what you want to do is open a form and ensure that it is not visible.

If so, there are two methods:

In the Form_Open() event:

Code:
Me.Visible = False

and in the code that actually opens the form.

Code:
DoCmd.OpenForm "MyForm", , , , , acHidden

Or are you referring to the Database Window? The one that contains the tab wherby you can navigate between your tables, queries, forms, etc.
 
Actually I'm referring to hiding the database window, so that the form looks like a program without the Access GUI behind it. The form should pop up and minimize the surrounding MS Access "components".

Sorry about the code formatting.

Thanks for your help :)

Pat
 
It's simple to hide.

Just go to the Tools -> Startup menu and select Hide Database Window.

When the database opens, the window won't be visible.
 
Continued on thread above so I've closed this thread. :cool:
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom