Hi Albert,
Thank you for your comments. I want to hide all of the Access interface and
let my code control the program. When you hide the Ribbon, you still see the
menu bar and quick access menu. I just want a black screen that displays my
forms at runtime. This is obviously more difficult that I anticipated.
Isn't there a simple set of switches, beyond those in the options menus, that
lets you hide or display various interface elements beyond the Ribbon?
- Show quoted text -
There are several methods for doing this. One of the slickest I've
seen is listed below. Unfortunately, I don't remember where I got this
code from, so I can't give credit where it's due.
Post the code below into a new module in your database.
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 DoAccessWindow(nCmdShow As Long)
' This function can minimize Access behind the scenes.
'Usage Examples
'Maximize window:
' ?DoAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?DoAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?DoAccessWindow(SW_HIDE)
'Normal window:
' ?DoAccessWindow(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
DoAccessWindow = (loX <> 0)
End Function
Now you can use the DoAccessWindow() function to mess with the Access
window. You may want to play around with the hide option, as it
totally hides the Access interface. A word of warning, any form you
want to display must be Popup and Modal in order to be visible.
So for instance, on the Form_Open event of whatever Form you have set
to load at startup, you could use the code DoAccessWindow(0) to hide
Access's interface, then on the Form_Close event, you would use
DoAccessWindow(1) to show the interface again.
Keven Denen