Hide Runtime Window Question (1 Viewer)

DBug

Registered User.
Local time
Today, 13:53
Joined
Jan 3, 2017
Messages
24
I have tried the following code, which works to hide the access runtime window. However I need to set the main form as popup and modal in order for the form to appear.

There are buttons on my main form which open other forms, (the main form still open)

however this form also has to be popup and modal also to appear.

Can the forms be opened non modal?, they work fine if the runtime window is minimized but if the user clicks on the runtime window it restores and the forms no longer display correctly, which is why I want to hide it

---------------------------------------------------------------------------

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
 

ByteMyzer

AWF VIP
Local time
Today, 05:53
Joined
May 3, 2004
Messages
1,409
The forms can be opened non-modal, provides that the forms' PopUp property is set to True.
 

DBug

Registered User.
Local time
Today, 13:53
Joined
Jan 3, 2017
Messages
24
I have tried that, popup = true, but the forms do not appear when the runtime window set to hide, they do appear when runtime is set to minimized
 

static

Registered User.
Local time
Today, 13:53
Joined
Nov 2, 2015
Messages
823
Access is an MDI (multiple document interface) application.


Forms, reports, table views, etc, are all child windows belonging to Access.
It wouldn't make any sense to be able to separate a child window from its parent or allow the child to be visible when the parent isn't. That would break the way Windows works.
 

DBug

Registered User.
Local time
Today, 13:53
Joined
Jan 3, 2017
Messages
24
That makes sense, just wondering why then the HIDE function is built into the code I borrowed
 

DBug

Registered User.
Local time
Today, 13:53
Joined
Jan 3, 2017
Messages
24
Minimizing the Access Runtime Window allows form/s to be displayed correctly. The only problem is if the user clicks on the Access icon on the taskbar, it restores. Once restored the forms 'sttach' themselves to the main window.ie clicking minimize on the access form now minimizes the Form/s as well.

I have found that if I drag the access window below the taskbar out of view, it now acts and behaves as if the access window is hidden. Even clicking the taskbar icon does not bring the Access window back into view

It would be ideal if instead of minimizing the Access Window, the position of the window is changed to below the taskbar using VBA code, this making the Access window appear hidden, and the forms a standalone application
 

static

Registered User.
Local time
Today, 13:53
Joined
Nov 2, 2015
Messages
823
It would be taking advantage of a bug in Windows. Not ideal.

If you want to get rid of Access build your UI in another environment.
 

DBug

Registered User.
Local time
Today, 13:53
Joined
Jan 3, 2017
Messages
24
Found this code, which I have used to move the access window out of view

peterssoftware.com/winmanip.htm
 

DBug

Registered User.
Local time
Today, 13:53
Joined
Jan 3, 2017
Messages
24
put the above module in my application then used the following code on the main Form

Private Sub Form_Load()

' hide the access ribbon
DoCmd.ShowToolbar "Ribbon", acToolbarNo
' set position of access window below visible desktop
xg_SizeWindow "Access", 0, 1000, 2, 2

End Sub
 

Users who are viewing this thread

Top Bottom