dbTalk Databases Forums  

access2007 maximizing a report

comp.databases.ms-access comp.databases.ms-access


Discuss access2007 maximizing a report in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roger
 
Posts: n/a

Default access2007 maximizing a report - 11-29-2010 , 02:53 PM






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

Reply With Quote
  #2  
Old   
Marshall Barton
 
Posts: n/a

Default Re: access2007 maximizing a report - 11-29-2010 , 07:19 PM






Roger wrote:

Quote:
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

Reply With Quote
  #3  
Old   
Roger
 
Posts: n/a

Default Re: access2007 maximizing a report - 11-30-2010 , 05:13 AM



On Nov 29, 6:19*pm, Marshall Barton <marshbar... (AT) wowway (DOT) com> wrote:
Quote:
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 -
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

as to putting the zoom after the call to openReport, it would only be
a doevents and a 'maximize' later, I doubt the report would be open

maybe I can check the reports collection, with error checking, hoping
that once the report is in the collection, it is loaded

Reply With Quote
  #4  
Old   
James A. Fortune
 
Posts: n/a

Default Re: access2007 maximizing a report - 11-30-2010 , 12:39 PM



On Nov 30, 6:13*am, Roger <lesperan... (AT) natpro (DOT) com> wrote:

Quote:
maybe I can check the reports collection, with error checking, hoping
that once the report is in the collection, it is loaded
You don't need error checking to do that. The Reports collection
contains only open reports. You can use the Reports collection and
try to match the name of the report you are trying to open. The
Documents collection can be used to list of all the reports in the
database, whether open or closed.

James A. Fortune
CDMAPoster (AT) FortuneJames (DOT) com

Reply With Quote
  #5  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: access2007 maximizing a report - 11-30-2010 , 07:44 PM



Roger <lesperancer (AT) natpro (DOT) com> wrote in
news:c2829f17-98e2-44c2-834e-58755796f604 (AT) 35g2000prt (DOT) googlegroups.com
:

Quote:
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
Can't you run DoCmd.Maximize before opening the report?

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.