By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,984 Members | 2,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,984 IT Pros & Developers. It's quick & easy.

get and set form position

P: n/a
Hi all

Can anyone advise how to get the position of an open form and how to set the
position of an opening form within the access window.

I have: MA Access97 (because I do not have the funds to obtain a more recent
version nor the time to learn the new interface)
Form1 and form2. Both forms are an identical size because of the length of
the captions of the controls on the forms.

Form1 which shows the user a list of check boxes

Some of the check boxes have further options which are displayed as check
boxes on form2.

Code within the form1 check boxes looks to see whether further options exist
and if they do will open form2

I want form2 to display distance N away from the top line of form1 so the
user can see that both forms are open. Thus form2 left will be the same as
form1 left but form 2 top will be form1 Top - 15mm. I have found references
to .top and .left but these properties are not available.

Currently both forms are autocentrered so when form2 is opened it obscures
form1. This is confusing to the user who thinks form1 has closed.

Any suggestions gratefully received as my research so far has drawn a blank

Many thanks

Andrew Hall
Mar 17 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The actual properties to use are WindowTop, WindowLeft, WindowHeight,
Window Width.
Other properties you may need to consider are Form.Detail.Height and
Form.Width. These are seperate from the window properties and can be
different. The window size is not always the size of the form.

To move the form, use the DoCmd.MoveSize method. This allows you to
position the form relative to the Access window and to resize the form
if needed.

Note: The 0,0 (origin) point in Access is the topmost and leftmost
corner of the Access window BELOW the lowest menubar. The origin
relative to the actual screen can change depending on how many menus
are on screen.

Mar 17 '07 #2

P: n/a
On Sat, 17 Mar 2007 16:12:07 GMT, Andrew Hall wrote:
Hi all

Can anyone advise how to get the position of an open form and how to set the
position of an opening form within the access window.

I have: MA Access97 (because I do not have the funds to obtain a more recent
version nor the time to learn the new interface)
Form1 and form2. Both forms are an identical size because of the length of
the captions of the controls on the forms.

Form1 which shows the user a list of check boxes

Some of the check boxes have further options which are displayed as check
boxes on form2.

Code within the form1 check boxes looks to see whether further options exist
and if they do will open form2

I want form2 to display distance N away from the top line of form1 so the
user can see that both forms are open. Thus form2 left will be the same as
form1 left but form 2 top will be form1 Top - 15mm. I have found references
to .top and .left but these properties are not available.

Currently both forms are autocentrered so when form2 is opened it obscures
form1. This is confusing to the user who thinks form1 has closed.

Any suggestions gratefully received as my research so far has drawn a blank

Many thanks

Andrew Hall
1) Do not use the AutoCenter property of either form.

2) Look up the MoveSize method in VBA help.

Note: All measurements are in Twips (1440 per inch). You'll have to do
the math to convert inches to cm.

Set Forms1 to a specific position in the window (I'm using inches
measurements). For example, code the Form's Open Event:

DoCmd.MoveSize 3 *1440, 4 *1440

3 inches from the left edge of the screen, 4 inches down from the top
of the screen.

Set theForm2 position similarly to position it .6 inch below the
Form1. Code the Form2 Open Event:

DoCmd.MoveSize 3*1440, 4.6* 1440

Also 3 inches from the left edge of the screen, but 4.6 inches down
from the top of the screen.
Adjust the actual placement as required.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Mar 17 '07 #3

P: n/a
Thanks for the advise

A great help

I now have forms positioned all over the place

Andrew

"Andrew Hall" <an**********@virgin.netwrote in message
news:rr*****************@newsfe7-gui.ntli.net...
Hi all

Can anyone advise how to get the position of an open form and how to set
the
position of an opening form within the access window.

I have: MA Access97 (because I do not have the funds to obtain a more
recent
version nor the time to learn the new interface)
Form1 and form2. Both forms are an identical size because of the length of
the captions of the controls on the forms.

Form1 which shows the user a list of check boxes

Some of the check boxes have further options which are displayed as check
boxes on form2.

Code within the form1 check boxes looks to see whether further options
exist
and if they do will open form2

I want form2 to display distance N away from the top line of form1 so the
user can see that both forms are open. Thus form2 left will be the same as
form1 left but form 2 top will be form1 Top - 15mm. I have found
references
to .top and .left but these properties are not available.

Currently both forms are autocentrered so when form2 is opened it obscures
form1. This is confusing to the user who thinks form1 has closed.

Any suggestions gratefully received as my research so far has drawn a
blank
>
Many thanks

Andrew Hall


Mar 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.