Hi,
I'm using Access 2010 on a 64 bit Win7 Premium box.
I have a very simple report which is triggered from a form button. There are only a few lines in the report and only one text box that displays the results. The report opens in preview mode. But I want to expand it on the screen as much as possible. Normally when opening a report in preview mode I believe it opens as 'fit to window' or a rather small window. I can maximize the window. But once done, if you click in the window, the size of the report increases again and is much more readable. That's what I'd like to achieve thru vba.
Here is the Report_Open code:
Code:
Private Sub Report_Open(Cancel As Integer)
Public Const TWIPSPERINCH = 1440 'This line is actually in a module declaration. I put it here to clarify the code.
DoCmd.MoveSize 1 * TWIPSPERINCH, 0.5 * TWIPSPERINCH, 8 * TWIPSPERINCH, 5 * TWIPSPERINCH
DoCmd.RunCommand acCmdZoom100
End Sub
When the Report_Open code gets to the last line it throws the runtime error 2046; command or action 'Zoom 100%' isn't available now.
I've tried a couple of different Zoom amounts all with a similar error. I've also tried replacing the DoCmd.MoveSize line with just DoCmd.Maximize. Again with the same result on the acZoom line.
Any thoughts?
Happy holidays,
Vic