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!

Preview maximized

Status
Not open for further replies.
Apr 22, 2003
6
US
I'm using a DoCmd to OpenReport in Preview mode. Is it possible (in VBA) to open the report as Maximized on the screen?


John Rose
 
Sure, after your OpenReport statement, put code like this:
Code:
DoCmd.Maximize
 
Another step in this is to make sure your calling form returns to its previous size. By using the docmd.Maximize the report will maximize in preview and then when you close the report control returns to the calling form. WOW!! you say. It is maximized also. Easy fix here.

In the On Activate event procedure of the form put the following code:
DoCmd.SelectObject A_FORM, "frmCallingFormName"
DoCmd.Restore

Let me know if this helps.

Bob Scriver
 
Immediately after I posted this, I realised that I knew the answer i.e. DoCmd.Maximize in the OnOpen event for the report. However, this then led to another question: when using DoCmd.OpenReport, how can one tell if the report has been opened in Preview or Print mode (in the OnOpen event)? The reason for doing this is so as not to execute the DoCmd.Maximize method and not to execute some code that I have for attaching a Command Bar when in Preview mode.

John Rose
 
Thanks Bob.

Strangely enough, I don't need the "Restore" code because the calling form is not Resizeable but it's useful to know.

You can tell I've had a long day: my last message should have said "when in Print mode" at the end.



John Rose
 
Thanks Bob for:
DoCmd.SelectObject A_FORM, "frmCallingFormName"
DoCmd.Restore

I did need to use it after all. Looking at things today I don't understand how I wouldn't have needed it!

I previously posted a thread on using custom paper sizes. In Design view, there are only a limited range of paper sizes under File|Page Setup. I want to use 5.5" high by 8.5" wide (i.e. a non-standard one) in a dot matrix printer. There seems to be no facility to input Height or Width of paper. Any ideas?

John Rose
 
I have not any need to manipulate the custom paper sizes. I believe that when you are in design view for the report you can modify the custom paper sizes through the appropriate menu selections and then save the report. The report then holds these settings. They will always be set this way for you when you run the report. They should not default back to original standard settings.

I will do some testing on this today and see if I can get something to work for you.

Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top