任何人都可以告诉我如何在Access 2007中的窗体上显示全屏,以便没有工具栏等打开,所以没有人可以篡改任何东西?
干杯, 尼克C
答案 0 :(得分:1)
有几种方法可以做到这一点。我见过的最简单的一个如下所示。不幸的是,我不记得我从哪里得到这个代码,所以我不能在它到期的地方给予信任。
将以下代码发布到数据库中的新模块中。
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
现在您可以使用DoAccessWindow()函数来破坏Access窗口。您可能想要使用hide选项,因为它完全隐藏了Access接口。一句警告,您要显示的任何表单必须是Popup和Modal才能显示。
例如,在Form_Open事件中,您可以使用代码DoAccessWindow(0)来隐藏Access的接口,然后在Form_Close事件上,您将使用DoAccessWindow(1)再次显示该接口。