Share via

Access 2016 in runtime opens forms off center

Anonymous
2019-03-04T22:18:19+00:00

I'm converting Access applications from Access 2010 to 2016.  These apps/files are distributed as runtime applications to my users.  (Ie, the file extension is .accdr)  When the application is first opened, it automatically opens a Form which fills the screen.  The file is set for "Document Window Options - Overlapping Windows"  (not tabbed documents).  So, the form opens and fits just inside the available space.

When the app is opened in 2010, the form opens just fine.  When the app is opened in 2016, the form is opened off center so that the bottom part of the form is off the screen and there is blank/gray space above the form.  I can open the same app as a .accdb file in full Access 2016 and the form is opened perfectly centered again.

Any ideas on what might be going on and how I could fix it?  I have many forms which JUST fill the screen.  Having the vertical scroll bar on the right side of the screen and that first form be off center is a big problem.

Thank you!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2019-03-08T08:40:27+00:00

It occurred to me, looking back to my DOS (pre-Windows) days that there had to be a way to place a form on an exact point on the screen, just as it's so obvious for the various elements that are placed within a form (ie the Top/Left properties).

I found it for MS Access forms- try this:

  1. Set the form's AutoCenter property to "No."
  2. Look up the MoveSize method in VBA help.
  3. The uppermost, left corner of your screen would be 0,0. In the form's On Open event, place this function:

DoCmd.MoveSize 0,0


To take it a bit further, note that all measurements are in Twips (1440 per inch). You'll have to do the math to convert inches to cm. To set your form to a specific position in the window (I'm using inches measurements). For example, code the Form's On Open Event:

DoCmd.MoveSize 3 *1440, 4 *1440

3 inches from the left edge of the screen, 4 inches down from the top

of the screen.

To set another form's position similarly to position it .6 inch below the

Form1. Code the Form2 Open Event:

DoCmd.MoveSize 3*1440, 4.6* 1440

Also 3 inches from the left edge of the screen, but 4.6 inches down

from the top of the screen.

Adjust the actual placement as required.

Does this solve your position problem?

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
2019-03-09T02:32:45+00:00

Nice suggestion Al. So cool what the community will come up with.

@SandraS: knowing you are more than a basic user, it may make sense to read up on how to watch Form events and write code once for all forms. Search the web for "access form class withevents". This technique gives you a lot of power for example doing a MoveSize in all Form_Open events without ever writing that code there.

Personally I use such code to invoke code to color required fields with a different background color, and also to populate the ubiquitous DateCreated/DateCreatedBy/DateUpdated/DateUpdatedBy fields, among other usages.

Tools such as the excellent "MZ-Tools" can help write the tiny bit of "bootstrap" code that each form needs to have; then you write generic code in the class module. Highly recommended.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

16 additional answers

Sort by: Most helpful
  1. Anonymous
    2019-03-05T19:21:59+00:00

    I tried to pin down what the problem is.  Here's further information:

    I created a new Access .accdb from scratch.  I set the file property to "Overlapping Windows" and created a simple form, filling the area with the ribbon shrunk up.  Finally, I created an AutoExec macro to open the simple form.

    When I opened the file in Access 365, the problem did *not* occur.  The problem did not occur whether I opened the file as a .accdb nor as a .accdr.

    So, then I created a simple custom ribbon (which would show when the file was opened as a .accdr).  And viola, the problem happened when the file was opened as a .accdr, but not as a .accdb--just like what I am experiencing with my real applications.

    So, the problem is specific to: 1) a file run in runtime mode, 2) a ribbon being part of the file/ribbon showing on the screen, 3) Access 365 (does not happen in Access 2010).

    Does this added info spark any ideas from people?  Thanks!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-03-05T17:32:10+00:00

    Tom:

    Thanks for the reply.  I wish it were that easy. The form's AutoCenter property is already set to true.  I set almost all my forms that way, but I double-checked this one test form just to make sure.  AutoCenter is definitely set to True.

    To clarify: I found out that I actually have Office 365.  The msaccess.exe file is in the following folder:  C:\Program Files (x86)\Microsoft Office\Root\Office16.  However, when I look inside of Access, it says that I have Office 365, Version 1901.  I don't know if that makes a difference.

    Problem Clarification: The application/form opens fine in Access 2010 regular and runtime.  The application/form opens fine in Access 365 when the file has the .accdb extension.  The problem is when I try to open the same application/file with the .accdr extension in Access 365.  Access 365 seems to open the form just fine for a split second and then pushes the form down so that the bottom part of the form is off the screen.

    To further define the problem:  This problem is only a startup problem.  I can close and re-open the form in Access 2016 with the .accdr extension, and the form opens centered just fine in subsequent openings (ie, after the initial startup).  There is some weird bug happening just when the file is first opening.

    Any other thoughts?  Anyone able to replicate the problem?

    Was this answer helpful?

    0 comments No comments
  3. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2019-03-05T02:42:34+00:00

    Set the form's AutoCenter property to True.

    Was this answer helpful?

    0 comments No comments