Open report when another report closes

  • Thread starter Thread starter Martin Dashper
  • Start date Start date
M

Martin Dashper

Is there any way to make something like the following work?

DoCmd.OpenReport "MyReport_1"

followed, in MyReport_1, by

Private Sub Report_Close()
DoCmd.OpenReport "MyReport_2"
end sub

I can get this to work in 'acPreview' mode, but not when printing
directly to the printer.

Martin Dashper
 
Try:
DoCmd.OpenReport "MyReport_1"
Do While IsLoaded("MyReport_1", acReport)
DoEvents
Loop
DoCmd.OpenReport "MyReport_2"

Public Function IsLoaded(strObjName As String, Optional lngObjType As
acObjecttype = acForm) As Boolean
' Returns True if strName is Open (non-zero), False(0) otherwise.
' Should return 0, not an error, if the object doesn't exist
' Default Object is Form
On Error Resume Next
IsLoaded = (SysCmd(acSysCmdGetObjectState, lngObjType, strObjName) <> 0)
End Function

HTH,
 
Back
Top