Solved

center a report on application window

Posted on 2013-11-17
8
269 Views
Last Modified: 2013-12-29
I would like to center a ms access report on the application screen using vba.Thanks
0
Comment
Question by:Svgmassive
  • 4
  • 2
  • 2
8 Comments
 
LVL 84
Comment Utility
Just set the Auto Center property to True. Open the report in Design view, open the Property Sheet, and select the Format tab. You'll see Auto Center in the listing - set that to True.
0
 

Author Comment

by:Svgmassive
Comment Utility
VBA
0
 

Author Comment

by:Svgmassive
Comment Utility
I can do that but that's not what i am looking for
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
You can use DoCmd.MoveSize to manipulate the position of an object in Access:

DoCmd.MoveSize 2880, 2880

This would move the object to approximately 2 inches below the top, and 2 inches to the right of the screen edge. The values above are in Twips, and 1440 Twips = 1 inch (approximately).

As to "center" - you'd have to further define that. Do you mean the center of the Screen, the center of the Access application, center of another object ... etc etc

Here's a link to a module on the MVPS website that goes into a little more depth: http://access.mvps.org/access/forms/frm0042.htm
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 21
Comment Utility
Could you be wanting to change the Zoom level?

Example:

DoCmd.OpenReport "rptYourReport", acViewPreview
DoCmd.RunCommand acCmdZoom100 

Open in new window



or maybe this method:

In the report's On Open event try using this code:

DoCmd.Maximize
DoCmd.RunCommand acCmdZoom100

Open in new window


You may also need to include in the report's CLOSE event to use this:
 
DoCmd.Restore

Open in new window

0
 

Author Comment

by:Svgmassive
Comment Utility
still have not been able to have this issue addressed.
0
 
LVL 21
Comment Utility
I think there is some confusion as to what you want. I know am am not sure what you really want.

Between LSMConsulting's suggestions and mine, we have covered the common solutions when people ask about "centering" a report.

In Access 2007 or later, there is  Print Preview mode and Report View mode. You may be wanting Print Preview mode.

I am confident we can provide a solution once we understand exactly what you want. Can you example in more detail exactly what you are needing?

Also it would hep to know:
What version of Access?
Are you display the report in Print Preview mode  or Report View mode (2007 or later)?
0
 

Author Comment

by:Svgmassive
Comment Utility
I am using access 2010,Here's the problem,I am using the custom function PreviewAndZoomReport i would like to set my own zoom value when i specify a value the report opens to the left of the screen even with the autocenter set to yes,I would like to use vba to center the report on the screen.thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now