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

VBA Code to Set Paper Size & Orientation - MultiUser DB 2

Status
Not open for further replies.

DaleWatson123321

Programmer
Jun 12, 2001
1,788
CA
Hi,

I'm relatively new to VBA for Access, and would very much appreciate help with setting up code for setting the Paper Size and Page Orientation.

I'd also appreciate if you can be specific.

My end-users (using Access '97) are forced to "manually" specify the page settings - for several reports. Management expects that something this simple should be easy to make automatic - i.e. with code.

I've looked extensively through Tek-Tips and Access Help, and haven't been able to find any code for this.

Thanks very much, and your help will of course be rewarded with a STAR. :)

...Dale Watson dwatson@bsi.gov.mb.ca

 
When you design the report, go to File, choose Page Setup. Any settings you set in there will be the permanent settings for the report. You can set margin size, orientations etc, and the user won't have to do it.

If you want the user to do it, set a button up that opens the report in design mode and send them a message telling them to do the same thing.
 
Hi,

As a start on report printing, take a look at Help on:
"OpenReport Method. The OpenReport method carries out the OpenReport action in Visual Basic. For more information on how the action and its arguments work, see the action topic.
Syntax
DoCmd.OpenReport reportname[, view][, filtername][, wherecondition]

I don't know your current db set-up / design, but you could consider placing a Command Button on a form the User accesses. Then when User clicks the button, your code behind button starts out with Input Box asking certain questions to spec out the report. Then taking the responses from User, your code inserts those answers into the DoCmd above parameters. You could also have different buttons for different reports, or you could open a form serving a Report Menu with many buttons to select. .... Ideas to consider.
I do not know off hand how to set the Portrait/Land through code. But above code at least automates the preview of a report in your Collection.
Jeff

 
Thanks guys for your efforts, but I had already set up the reports with the specifics re page size, orientation, margins, etc.

Subsequent to my posting this request for help, I did some further checking and discovered the following thread - which seems to confirm my suspicions - that there is indeed a limitation (bug ?) in Access '97 with regard to page-settings not "holding" for other users.

Please refer to thread703-82676.

The best solution is obviously to upgrade (MS has "got us again" :)). In the meantime, I (already) have a button that takes "new" users to a screen that explains the (relatively simple) steps of specifying the page-settings.

I had hoped that some "VBA Expert" might have discovered a "workaround" using VBA.

Thanks anyway for your contribution - ... a STAR as promised. :)

...Dale Watson dwatson@bsi.gov.mb.ca
 
Yes, I've run into that. The solution was to go to the user's desktop, open options and set all their margins to 0. The 0 will then be changed by Access to some small minimum number. After you do that, your report settings will not be overridden. Real solution: get rid of 97!



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top