Form's Auto Center

Though the Auto Center of a form in an Access 2010 database is set to Yes,
the form doesn't open in the center of screen.
Document Window Options for this database is set to Overlapping Windows.

What can be the possible reasons?

thanks for any kind of help/advice.
Who is Participating?
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
Crashed ... well, for good measure, run this procedure:

0) **Backup your MDB BEFORE running this procedure**
1) Compact and Repair the MDB, as follows:
Hold down the Shift key and open the MDB, then from the menu >>Tools>>Database Utilities>>Compact and Repair ...
Close the mdb after the Compact & Repair.
2) Execute the Decompile (See example syntax below) >> after which, your database will reopen.
3) Close the mdb
4) Open the mdb and do a Compact and Repair (#1 above).
5) Close the mdb.
6) Open the mdb:
    a) Right click over a 'blank' area of the database window (container) and select Visual Basic Editor. A new window will open with the title 'Microsoft Visual Basic' ... followed by then name of your MDB.
    b) From the VBA Editor Menu at the top of the window:
        Note ... after the word Compile will see the name of your 'Project' - just an fyi.

7) Close the mdb
8) Compact and Repair one more time.

*** Executing the DeCompile **EXAMPLE**:
Here is an **example** of the command line syntax  (be SURE to adjust your path and file name accordingly) before executing the decompile:

Run this from Start>>Run, enter the following command line - **all on one line** - it may appear like two lines here in the post:
Also, the double quotes are required.

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\YourMdbNameHERE.mdb"

For more detail on the Decompile subject ... visit the Master on the subject (and other great stuff) Michael Kaplan:

AND ...
Once you get familiar with the Decompile idea (and ALWAYS make a BACKUP first!) ... you can add both Decompile and Compact/Repair to the Right Click menus in Windows Explorer, which I use multiple times daily:

Getting the Decompile and Compact context menu options

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Do you have any code in the Form Load or Open event that would be changing the position ?

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Is this the only form that is open?

I just tried several different settings (with AC set to Yes) ... and each time it opens in the Center.

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

MnInShdwAuthor Commented:
here's what I have in the onLoad action:

' Halt screen flashing
    Application.Echo False
    ' Select an object in the database window
    DoCmd.SelectObject acForm, Me.Name, True
    ' And hide the window
    DoCmd.RunCommand acCmdWindowHide
    Application.CommandBars.DisableAskAQuestionDropdown = True
    Application.CommandBars.DisableCustomize = True
    Application.SetOption "Show Status Bar", False
    ' Show 'em what we've done
    Application.Echo True

Open in new window

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
As a *TEST* ... comment out all the code and see if it works.

Maybe specifically the acCmdWindowHide

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Also, where are you UnHiding that form ?

MnInShdwAuthor Commented:
Yes, this is the only opened form.
Actually the Display Form option for this database is set to the mentioned form.
It means when somebody opens the database, this form is opened. So there can't be
any other opened form.

The interesting point is that everything was just fine until a week ago.
(the form was centered when opened)

A week ago, the database crashed and I had to Compact & Repair it.
Since then this form isn't centered. (the other forms are centered)

thank you.

MnInShdwAuthor Commented:
Commenting out all the codes from the onLoad action didn't help.

And I had gone through the Repair steps as mx explained above after the database crashed
last week except of Decompile section.

I'll do it once again to see if it helps.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Decompile ... for sure.  Make a BACKUP first ...

MnInShdwAuthor Commented:
Decompile didn't help either.

MnInShdwAuthor Commented:
I opened the form in design view and did a Ctrl+S to save it once again.

Now the form is centered again.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Yeah, I messed with that also, but ... should not be necessary with AC set.  Can you upload a version before doing that ... that has the issue ?

MnInShdwAuthor Commented:
Million thanks.

God knows how many times you've helped me.
This was a good lesson for future crashes.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.