'Zauwazylem, ze w Report_Open tryby wydruku lub podgladu roznia sie atrybutem
'WS_DISABLED. Czyli daje sie to wykryc np. za pomoca takiej procedury:
Private Declare Function GetWindowLongA Lib "user32" _
(ByVal hwnd&, ByVal nIndex&) As Long
Private Sub Report_Open(Cancel As Integer)
Const WS_DISABLED = &H8000000
Const GWL_STYLE = -16
Dim lFlag As Long
lFlag = GetWindowLongA(Me.hwnd, GWL_STYLE)
If (WS_DISABLED And lFlag) <> False Then
MsgBox "Wydruk"
Else
MsgBox "Podgląd"
End If
End Sub
'Krzysztof Pozorek
Inną metodę podał Hubert Dołęga:
'W Accessie 2000 Eng wydaje się również działać coś takiego:
Private Sub Report_Open(Cancel As Integer)
If FindWindowEx(Me.hwnd, 0, "OPrtPrevPage", vbNullString) = 0 _
Then Cancel = True
End Sub
'Hubert Arkadiusz Dołęga