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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a report open to "Fit"? 2

Status
Not open for further replies.

ErikZ

Programmer
Feb 14, 2001
266
US
Well, I asked this question in the "Access: Reports" Forum, but no one answered. So I'll try here:

Right now, my reports are opening up at default, "100%". How do I make it open to "fit"?

It didn't occur to me that this would be a problem, until I watched my boss be COMPLETELY at a loss, trying to see the whole report.
 
When creating your Report, try not to have it be any wider than 6 1/2 across and 8 inches in length.
 
When you run a report, it goes to the print preview screen, which opens at 100%. If you go to the control bar on the top, it lets up change the view to different levels of magnification. One of the options in there is not a number (50%, 100%, 200%) but it is called "Fit". If you choose that the report is resized to fit in the window space available.

Changing the size of the output does not change this behavior.
 
I was talking about the width and length in the design view section. Does your data stretch across the 6 1/2 way mark or is it longer than the 8 inch mark?
 

The page is between the 6.5 inch mark and the 8 inch mark. I needed more space than the 6.5 inches so I reduced the margins by an inch and increased the page area by an inch.

What does this have to do with the print preview? It all fits on one printed page.
 
Sorry about that. I misunderstood your question. Make sure that in the Properties box of your Report that you have "Auto Resize" set to yes.
 
AutoResize? Is that a property in Access97 reports? I don't see it anywhere in the Property Sheet. Where can I find it?
 
Access for Office XP has this function. I'm not sure if it was just created or if its been around for Access 2000.
 
Open the Report in Print Preview, and follow that command with a RunCommand to size it to fit

DoCmd.OpenReport "YourReportName", acViewPreview
DoCmd.RunCommand acCmdFitToWindow

Also see acCmdZoom in Help to Zoom to other sizes such as 75%
.RunCommand acCmdZoom75
PaulF
 

Hmm, I had it run "DoCmd.RunCommand acCmdFitToWindow" upon opening. It gave me an error:

"Error 2046, Command or action "FitTowindow" isn't available now."

That's a new one to me. :)

It doesn't like the "RunCommand acCmdZoom75"

It likes "DoCmd.Maximize" though. Strange.
 
if you are putting the command in the report's open or load event, it doesn't belong there. It belongs in the same code module where you call the OpenReport command from.

PaulF
 
PaulF

Cool -- I had never tried putting the DoCmd.RunCommand acCmdFitToWindow in the *calling* code -- always had tried it in the Open event, where it fails. Thx!!

 
Hmm. Ok. I run the reports from the switchboard. After going though the code I came across:

' Open a report.
Case conCmdOpenReport
DoCmd.OpenReport rs![Argument], acPreview

Jackpot! So I add the line

DoCmd.RunCommand acCmdFitToWindow

Right after. Same error. "Command or Action 'FitToWindow' not available now."

If this isn't the calling code, then I don't understand what is.
 
Oh God, I feel like an Idiot. I left the "On Open" code in the report from last night. I found out when I started opening other reports and they worked perfectly!

Ignore the previous post everyone! The code works perfectly! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top