find middle of screen (1 Viewer)

smig

Registered User.
Local time
Today, 16:51
Joined
Nov 25, 2009
Messages
2,209
How can I find the middle of the screen, or at least the middle of the Access window ?
I want my login form to be placed in the middle of the screen.

Thank you,
Tal
 

JHB

Have been here a while
Local time
Today, 15:51
Joined
Jun 17, 2012
Messages
7,732
What if you set the Form's property "Auto Center" to "Yes"?
 

smig

Registered User.
Local time
Today, 16:51
Joined
Nov 25, 2009
Messages
2,209
What if you set the Form's property "Auto Center" to "Yes"?
Thanks,
This should do the job.
Totaly forgot about it :D
 

smig

Registered User.
Local time
Today, 16:51
Joined
Nov 25, 2009
Messages
2,209
I was too hapy too soon :)

AutoCenter cant be assigned in runtime (in VBA).
Since I change the form size based on some data it's not helping.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 14:51
Joined
Sep 12, 2006
Messages
15,693
but you would set autocentre for a login form at design time, wouldn't you?

you also have

runcommand accmdsizetofitform, instead of doing it manually.

It just makes the entire form visible at its default size.
 

smig

Registered User.
Local time
Today, 16:51
Joined
Nov 25, 2009
Messages
2,209
Resizing the form at run time is easy, using InsideHeight and InsideWidth

is there anything similar to runcommand accmdsizetofitform to center form ?
 
Last edited:

smig

Registered User.
Local time
Today, 16:51
Joined
Nov 25, 2009
Messages
2,209
Thank you
I'll try to find something
 

smig

Registered User.
Local time
Today, 16:51
Joined
Nov 25, 2009
Messages
2,209
Thank you
Will try it when I get back to my machine.

I think I could kiss you for this.
But it will be just a little kiss on the chick. My whife is the jelous type. LOL


*** Edit ***
The code work perfectly :)
Only thing need to be changed is when looking for the hwnd = "Microsoft Access" to look also for CurrentDb.Properties("AppTitle") if can't find "Microsoft Access"
 
Last edited:

Users who are viewing this thread

Top Bottom