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.
LVL 1
MnInShdwAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
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.

mx
0
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

0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

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

Maybe specifically the acCmdWindowHide

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Also, where are you UnHiding that form ?

mx
0
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.


0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
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:
       >>Debug>>Compile
        Note ... after the word Compile ...you 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:

http://www.trigeminal.com/usenet/usenet004.asp?1033

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
http://access.mvps.org/access/modules/mdl0039.htm

mx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Decompile ... for sure.  Make a BACKUP first ...

mx
0
MnInShdwAuthor Commented:
Decompile didn't help either.

0
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.

0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
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 ?

mx
0
MnInShdwAuthor Commented:
Million thanks.

God knows how many times you've helped me.
This was a good lesson for future crashes.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.