Link to home
Start Free TrialLog in
Avatar of MnInShdw
MnInShdwFlag for Japan

asked on

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.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Do you have any code in the Form Load or Open event that would be changing the position ?

mx
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
Avatar of MnInShdw

ASKER

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

As a *TEST* ... comment out all the code and see if it works.

Maybe specifically the acCmdWindowHide

mx
Also, where are you UnHiding that form ?

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


ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Decompile ... for sure.  Make a BACKUP first ...

mx
Decompile didn't help either.

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

Now the form is centered again.

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
Million thanks.

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