Access 2010 - AutoCenter a Form on Open

ismailr

Registered User.
Local time
Yesterday, 19:54
Joined
Oct 16, 2015
Messages
31
Hi Expert.
I am facing a challenge to show the form at the center of the screen. I am using Access 2010. I search on net but unable to get the correct guide line. I wanted to open the form in maximize mode to cover complete screen. The contains of the form should be displayed at the center.
I am attaching the sample db. Kindly advise me how I can achieve.
Thanking you.
Ismail
 

Attachments

which is it? centre a form or maximise? For the former check out the 'auto center' property for the form, and the latter the 'fit to screen' property. Note that both of these only work if the db has been set for overlapping windows (file>options>current database) and/or the form modal property is set true
 
Thanks CJ
I wanted to achieve both, fisrt on open form should be maximize and then the contains should be displayed at center. Is it possible? Please advice or make the change in thr sample which i uploaded. Thanking you in anticipation. Ismail
 
if you mean display controls in the centre of the form then you either need to calculate their relative position to the centre of the form and modify their left and top properties accordingly or if using 2010, take a look at the control anchor properties (don't use them myself, so google to find out more).

You can determine the centre of the screen - me.height/2 and me.width/2 and then use maths to work out the new values for left and top.
 
should have said - put any code in the form resize event
 
Dear CJ, i am new for MS Access and always taking help from expert from this forum like you. I will be very thankful, if you change my sample and put the necessary code in it. please make is simpler to understand. Thanks. Ismail
 
here, i took the time just for you. please read the code behind the form.
 

Attachments

Users who are viewing this thread

Back
Top Bottom