2009-07-17 3 views
1

Quelqu'un peut-il me dire comment je peux afficher en plein écran sur un formulaire dans Access 2007 afin qu'aucune barre d'outils, etc., ne soit ouverte, afin que personne ne puisse altérer quoi que ce soit?Access 2007 Afficher en plein écran

Cheers, Nick C

Répondre

1

Il existe plusieurs méthodes pour ce faire. L'un des plus lisses que j'ai vu est listé ci-dessous. Malheureusement, je ne me souviens pas d'où j'ai eu ce code, donc je ne peux pas donner de crédit là où il est dû.

Postez le code ci-dessous dans un nouveau module dans votre base de données.

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 

Maintenant, vous pouvez utiliser la fonction DoAccessWindow() pour modifier la fenêtre Access. Vous pouvez jouer avec l'option hide, car elle masque totalement l'interface Access. Un mot d'avertissement, toute forme que vous voulez afficher doit être Popup et Modal pour être visible. Ainsi, par exemple, dans l'événement Form_Open, vous pouvez utiliser le code DoAccessWindow (0) pour masquer l'interface d'Access, puis dans l'événement Form_Close, vous utiliserez DoAccessWindow (1) pour afficher à nouveau l'interface.