From: JonWayn on
I have searched the web for a solution on centering forms in Access but every
answer suggests using the AutoCenter property of the form. Well, in my
particular case, that doesnt work. See, I am opening a form, and in the Load
event of the form, I am adjusting the size of the form based on the amount of
text passed into the OpenArgs property, which is displayed on a label. So, to
rephrase the question:
How do I determine the new positions (Left and Top) of a form, given the
Width and Height of said form. I assume I need to somehow find the dimensions
of the screen in order to place the form, but how?

Thanks
From: Rick Brandt on
JonWayn wrote:

> I have searched the web for a solution on centering forms in Access but
> every answer suggests using the AutoCenter property of the form. Well, in
> my particular case, that doesnt work. See, I am opening a form, and in the
> Load event of the form, I am adjusting the size of the form based on the
> amount of text passed into the OpenArgs property, which is displayed on a
> label. So, to rephrase the question:
> How do I determine the new positions (Left and Top) of a form, given the
> Width and Height of said form. I assume I need to somehow find the
> dimensions of the screen in order to place the form, but how?

I use code from the Access 2000 Developer's Handbook, Part I by Getz,
Litwin, and Gilbert so I am not sure of the legality of posting it (so I'm
not). If you purchase a copy of that book you get a CD with it that
includes the functionality.

Basically it uses Windows API calls to determine the size of the form and
them position it. One of the choices is to center it in the Access parent
window.
From: Stuart McCall on
"JonWayn" <JonWayn(a)discussions.microsoft.com> wrote in message
news:840651EA-3CED-4EFE-B0E1-C1DE8754F9D2(a)microsoft.com...
>I have searched the web for a solution on centering forms in Access but
>every
> answer suggests using the AutoCenter property of the form. Well, in my
> particular case, that doesnt work. See, I am opening a form, and in the
> Load
> event of the form, I am adjusting the size of the form based on the amount
> of
> text passed into the OpenArgs property, which is displayed on a label. So,
> to
> rephrase the question:
> How do I determine the new positions (Left and Top) of a form, given the
> Width and Height of said form. I assume I need to somehow find the
> dimensions
> of the screen in order to place the form, but how?
>
> Thanks

This should help you out:

http://www.smccall.demon.co.uk/Windows.htm#WinManip