|
yuab上次提到了怎样在弹出式窗体中预览报表,采用的方法确实好,但预览完后弹出的窗体经常不是用户需要的窗体,即使用setfoucs设置也不行,后来我分析,把代码稍改一下就行了。修改如下:
Public Function Opclose(i As Integer) '报表预览用
Dim frm As Form, intI As Integer
If i = 1 Then
fSetAccessWindow (SW_SHOWMAXIMIZED)
Else
fSetAccessWindow (SW_SHOWNORMAL)
End If
Dim intForms As Integer
intForms = Forms.Count ' 打开窗体的数目。
If intForms > 0 Then
For intI = intForms - 1 to 0 step -1 '原来为For intI = 0 to intForms - 1
Set frm = Forms(intI)
If i = 1 Then
frm.Visible = False
Else
frm.Visible = True
End If
Next intI
Else
' MsgBox "No open forms.", vbExclamation, "Form Controls"
End If
End Function |
|