当 Access 屏幕的其余部分已隐藏时,如何在 ac.preview 视图中显示 Access 报告?
How can I display Access report in ac.preview view when rest of Access screen has been hidden?
我有一个数据库,当它打开时,代码 运行s 隐藏了 Access 中除表单之外的所有内容。
这对用户来说看起来很棒,但我认为这会阻止我在 acViewPreview 视图中显示报告。
如果我在 运行ning 中阻止加载代码,那么我就可以在 acViewPreview 视图中查看报告。
我不完全理解隐藏加载事件表单中所有内容的代码(我几年前复制了它并且它有效但我不记得从哪里来所以不能相信实际的创建者)。
隐藏Access的代码:
Private Sub Form_Load()
Call fSetAccessWindow(0)
End Sub
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
如何暂时 reverse/disable On Load 代码,但仅当报告为 运行 时,或者可能有另一种查看报告的方法,该方法可以在 Access 被隐藏时使用加载代码?
注释掉代码行(单引号)以防止函数调用:
Private Sub Form_Load()
' Call fSetAccessWindow(0)
End Sub
或将其调用为 "show the window normal":
Private Sub Form_Load()
Call fSetAccessWindow(1)
End Sub
我有一个数据库,当它打开时,代码 运行s 隐藏了 Access 中除表单之外的所有内容。
这对用户来说看起来很棒,但我认为这会阻止我在 acViewPreview 视图中显示报告。
如果我在 运行ning 中阻止加载代码,那么我就可以在 acViewPreview 视图中查看报告。
我不完全理解隐藏加载事件表单中所有内容的代码(我几年前复制了它并且它有效但我不记得从哪里来所以不能相信实际的创建者)。
隐藏Access的代码:
Private Sub Form_Load()
Call fSetAccessWindow(0)
End Sub
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
如何暂时 reverse/disable On Load 代码,但仅当报告为 运行 时,或者可能有另一种查看报告的方法,该方法可以在 Access 被隐藏时使用加载代码?
注释掉代码行(单引号)以防止函数调用:
Private Sub Form_Load()
' Call fSetAccessWindow(0)
End Sub
或将其调用为 "show the window normal":
Private Sub Form_Load()
Call fSetAccessWindow(1)
End Sub