Hi, Can anyone tell me how I can show the full screen on a Form in Access 2007 so that there are no Toolbars etc open, so no one can tamper with anything ?
Cheers, Nick C
Hi, Can anyone tell me how I can show the full screen on a Form in Access 2007 so that there are no Toolbars etc open, so no one can tamper with anything ?
Cheers, Nick C
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, 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.