如何防止焦点更改回调用报表的表单 [英] How do I prevent focus changing back to the form that calls a report
问题描述
我有一个在打印预览中打开报表的表单,因为我希望用户在打印前看到报表,使用下面的函数
I have a form that opens a report in print preview, as I want the user to see the report before printing, using the function below
Public Function previewReport(strDocName)作为String,可选strSql As String,可选strOpenArg As String)As Boolean
On Error GoTo Err_PreviewReport
DoCmd.OpenReport strDocName,acViewPreview, ,strSql,acWindowNormal,strOpenArg
Exit_PreviewReport:
退出函数
Err_PreviewReport:
如果Err.Number<> 2501然后MsgBox" ReportsMenu> PreviewReport" + Err.Description
恢复Exit_PreviewReport
结束函数
Public Function previewReport(strDocName As String, Optional strSql As String, Optional strOpenArg As String) As Boolean
On Error GoTo Err_PreviewReport
DoCmd.OpenReport strDocName, acViewPreview, , strSql, acWindowNormal, strOpenArg
Exit_PreviewReport:
Exit Function
Err_PreviewReport:
If Err.Number <> 2501 Then MsgBox "ReportsMenu > PreviewReport " + Err.Description
Resume Exit_PreviewReport
End Function
问题是如果我使用Access 2007运行时那么打印的调用表单不是报告 - 完整版似乎没问题。我理解这是因为焦点已经移回到表单但是如何防止这种情况?我试图再次选择报告,但没有好处。
我在其他论坛上看过关于这个问题但没有解决方案的帖子。
Problem is if I use Access 2007 runtime then the calling form is printed not the report - full version seems to be OK. I understand this is because focus has moved back to the form but how to prevent this? I have tried to select the report again but no good. I have seen posts on other forums about the problem but no solutions.
韦德
推荐答案
嗨韦德,
检查是否将报告的PopUp属性设置为Yes有帮助。如果没有,您也可以尝试将acWindowNormal更改为acDialog。
check whether setting report's PopUp property to Yes helps. If it does not, you can also try to change acWindowNormal to acDialog.
这篇关于如何防止焦点更改回调用报表的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!