Zoom to 100 Percent on Open Report Event

G

Guest

How can I open a report to zoom to 100 percent rather than "fit" when I click
on a report. I tried doing this with the Open Report event, but I get the
error message "Can't use that property at this time" number 2046. If I
create a button on a form with the following to open the report, maximize and
zoom to 100, the button works:

docmd.openReport ReportName
doCmd.Maxmize
Runcommand acCmdZoom100

But when I try to attach the 'RunCommand acCmd100', I get the error message
described above. Is there some way that I can tell the report to maxmize and
zoom to 100 percent regardless of the way in which the report is opened?
 
S

Stefan Hoffmann

hi,

JR_06062005 said:
But when I try to attach the 'RunCommand acCmd100', I get the error message
described above. Is there some way that I can tell the report to maxmize and
zoom to 100 percent regardless of the way in which the report is opened?
After the

DoCmd.OpenReport "ReportName",...

run

Reports("ReportName").ZoomControl = 100 ' or = 0

mfG
--> stefan <--
 
G

Guest

What I want to do is to use one of the report events (such as OnOpen) to zoom
to 100. That way it doesn't matter how the report is opened; i.e., whether I
open the report with a VB command or simply double click the report. Is
there a way to do this?
 
D

Douglas J. Steele

Try:

Me.ZoomControl = 100

Not sure which event you'll have to put it in, though: play around until you
get it to work.
 
A

Allen Browne

What happens if you open the report in design view, and set its Auto Resize
property to No? Save. Close. Test.

From memory, that opens it at 100% by default.
 
G

Guest

Simple, but brilliant. It works. Thanks

Allen Browne said:
What happens if you open the report in design view, and set its Auto Resize
property to No? Save. Close. Test.

From memory, that opens it at 100% by default.
 
G

Gina Whipp

I misread, you do not want to put this on a command button you want this to
happen when you click on the report already opened. Oddly enough, mine does
zoom to 100% when I click on an open report, however, my report opens
maximized (don't know if that makes a difference or not). Did you try
Douglas' suggestion?

Gina Whipp
 
S

Stefan Hoffmann

hi,

JR_06062005 said:
What I want to do is to use one of the report events (such as OnOpen) to zoom
to 100. That way it doesn't matter how the report is opened; i.e., whether I
open the report with a VB command or simply double click the report. Is
there a way to do this?
There's no other way, as you may seen trying the other suggestions.


mfG
--> stefan <--
 
D

Dirk Goldgar

Allen Browne said:
What happens if you open the report in design view, and set its Auto
Resize property to No? Save. Close. Test.

From memory, that opens it at 100% by default.

Hah! I never knew that!
 
A

Allen Browne

You probably want to do that for all your reports:

Function FixEmAll()
Dim accObj As AccessObject
Dim strDoc As String

For Each accObj In CurrentProject.AllReports
strDoc = accObj.Name
DoCmd.OpenReport strDoc, acViewDesign, WindowMode:=acHidden
With Reports(strDoc)
If .AutoResize Then
.AutoResize = False
End If
End With
DoCmd.Close acReport, strDoc, acSaveYes
Next
End Function


(Drop the WindowMode part if you are using Access 2000.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top