Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sizing a report 2

Status
Not open for further replies.

KerryL

Technical User
May 7, 2001
545
US
Is there an easy way to automatically size a report when it is opened in preview mode?

When a landscape report is viewed on the screen at 100%, it is often too large to see the entire page without having to scroll left and right.

Can I have the report open at 85% instead of 100% so the user doesn't have to scroll back and forth to see all the data on the left and right edges of the report?

Thanks,
KerryL
 
After your OpenReport command, try something like this:
Code:
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow
 
I have always opened my reports with DoCmd.Maximize which is not what you want but if you click on the report preview the page will adjust automatically to show the full page on screen.

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
Not exactly what I want to do, but perhaps the users will prefer to have the report maximized instead of having to scroll back and forth.

If anyone knows how I can open a report at 85% magnification please let me know.

Thanks for the advice Frank and Cosmo.

 
FitToWindow sounds like what you would need, but if not, try:
Code:
DoCmd.RunCommand accmdZoom75
 
I tried using "DoCmd.RunCommand accmdZoom75" in the OnOpen Event of the report but received a VB error:

Run-time error '2051':
The RunCommand action was canceled.



I got the same error in the On Activate event. Where should the code be inserted for it to work correctly?
 
Are you opening the report by using a command button? That's where the RunCommand code should go, in the OnClick event, after the OpenReport command.
 
Actually, the report is launched right off of a menu button using the Open Report command.
 
OK, then put this code:
Code:
DoCmd.RunCommand accmdZoom75
in the OnClick event of the command button, right after the OpenReport command.....
 
I'm sorry, I mis-spoke. The report is being launched from the switchboard. A selection on the switchboard launches the report, which is based on a query.

If I try and Edit the Command of the switchboard item I'm limited to the selections in the drop-down box.

It does, however, give me the option of running code. Could I use code to open the report with the 'DoCmd.RunCommand accmdZoom75' line as part of it?
 
It worked just fine in a macro. I created the macro to open the report, then added the Zoom75% command and the report opens with a magnification level of 75%.

Thanks very much for your help, Cosmo!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top