![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have the following function that usually works but occassionally, the "DoCmd.RunCommand acCmdZoom100" statement fails with a The command or action 'Zoom100%' isn't available now. , i'm thinking it's a timing issue, ie. the report is not yet opened is there a way of making sure the report is opened / displaying data ? Public Sub openReport(strReport As String, Optional strWhere As String = "") On Error GoTo fErr DoCmd.openReport strReport, acViewPreview, , strWhere DoEvents DoCmd.RunCommand acCmdZoom100 DoEvents DoCmd.Maximize DoEvents fExit: On Error Resume Next Exit Sub fErr: If (Err <> 2501) Then errorLog "openReport " & strReport & " " & strWhere End If Resume fExit |
#3
| |||
| |||
|
|
Roger wrote: I have the following function that usually works but occassionally, the "DoCmd.RunCommand acCmdZoom100" statement fails with a *The command or action 'Zoom100%' isn't available now. , i'm thinking it's a timing issue, ie. the report is not yet opened is there a way of making sure the report is opened / displaying data ? Public Sub openReport(strReport As String, Optional strWhere As String = "") * *On Error GoTo fErr * *DoCmd.openReport strReport, acViewPreview, , strWhere * *DoEvents * *DoCmd.RunCommand acCmdZoom100 * *DoEvents * *DoCmd.Maximize * *DoEvents fExit: * *On Error Resume Next * *Exit Sub fErr: * *If (Err <> 2501) Then * * * *errorLog "openReport " & strReport & " " & strWhere * *End If * *Resume fExit You're right, the open event is too soon to do that. *Try using the Activate event or the report header section's Print event. *If all else fails, the safe place is back in the form that opens the report, right after the OpenReport line. -- Marsh- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
maybe I can check the reports collection, with error checking, hoping that once the report is in the collection, it is loaded |
#5
| |||
| |||
|
|
I'm looking for a generic 'open report' function, so that I maximize the report without the need to change every report, so using the activate / print event would defeat that goal |
![]() |
| Thread Tools | |
| Display Modes | |
| |