Positioning Form

F

Frank Wagner

I develop software for schools, and have a number of clients with old Windows
98 computers that use a screen resolution of 800 X 600. Whenever the
software is loaded on these older computers, some of the forms don't quite
fit. The problem, however, is not so much the fit, but the fact that Access
positions the forms half way down.

Is there anyway that I can have Access position the forms in the upper
left-hand corner, so people at least don't have to scroll up to start using
the forms.

Any help would be appreciated

Thanks
 
D

Dale Fye

Frank,

Checkout the docmd.MoveSize method

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
F

fredg

I develop software for schools, and have a number of clients with old Windows
98 computers that use a screen resolution of 800 X 600. Whenever the
software is loaded on these older computers, some of the forms don't quite
fit. The problem, however, is not so much the fit, but the fact that Access
positions the forms half way down.

Is there anyway that I can have Access position the forms in the upper
left-hand corner, so people at least don't have to scroll up to start using
the forms.

Any help would be appreciated

Thanks

You can use the MoveSize method to position (and size) the form.
Note that all measurements are in Twips, 1440 per inch.

Code the Form's Load event:

DoCmd.MoveSize 0.5 * 1440, 0.5 * 1440

Will position the form 1/2-inch down from the top and 1/2-inch from
the left edge of the screen.
 
F

Frank Wagner

Fred:

I tried the code you sent me, and it doesn't seem to do anything to the
form. It still opens up a little way down from the top, and clients have to
scroll up to start the form properly. I'm using Access 2000. I don't know
if that would affect things or not.

Any thoughts would be appreciated

Thanks
 
F

fredg

Fred:

I tried the code you sent me, and it doesn't seem to do anything to the
form. It still opens up a little way down from the top, and clients have to
scroll up to start the form properly. I'm using Access 2000. I don't know
if that would affect things or not.

Any thoughts would be appreciated

Thanks

You're there and I'm here. I can't see your database.
The code I sent you will position the form 1/2 inch down from the top
and in from the left. if you wish it placed elsewhere you have to
change the values.
Please post your exact code and the event you placed it in.
 
F

Frank Wagner

Fred:

Sorry for the delay in getting back to you.

The code I used is the following:

Private Sub Position_Click()

DoCmd.MoveSize 0.5 * 1440, 0.5 * 1440


It is activated by a test button I set up for that purpose. I have Access
2000 on a Windows XP machine. I even put the button way down on the form so
you have to scroll down to click it. When I click the button to active the
code, it goes through the routine, but nothing happens. The form still stays
positioned part way down from the top.

I thought I could work around it, but the problem keeps coming back

Any thoughts you have would be appreciated.

Thanks
 
D

Dale Fye

Frank,

You moved the form to 1/2" from the top and 1/2" from the left.

If you want the form to show up at the very top, left corner, then try:

Docmd.MoveSize 0, 0

It also sounds like the form is too big to fit vertically on the page. If
you maximize the form, will it appear on the page properly, or do you still
have to scroll down or right to get to all of your controls. If you still
have to scroll to the right or down, I would strongly recommend that you
rethink the layout of controls on your form. You can significantly reduce
the forms "foot print" by placing controls that have similar functions, or
which apply to a particular aspect of your data on a tab control.

If maximizing the form works, then you might want to play with the forms
InsideHeight and InsideWidth properties. For example, in the forms Open
event, you could have code like:

Private Sub Form_Open

docmd.MoveSize 0, 0
me.insideHeight = 5.0 * 1440
me.insideWidth = 7.0 * 1440

End sub

This would move the form to the top left corner of the Access window, then
it would set the forms height to 5" and width to 7"

HTH

Dale
 
F

Frank Wagner

Dale:

I tried what you indicated, and I think I at least understand the problem a
little better now.

It looks like the MoveSize command moves an unmaximized form to different
positions on a computer screen.

The issue I face, however, is trying to move a maximized form that extends
beyond the sceen so that it's upper left hand corner appears on the screen
when it opens.

Is there any way that this can be done?

Any help would be appreciated. Thanks
 
D

Dale Fye

Frank,

As I indicated in my previous post, shrink the size of your form so that it
all fits in a single screen, without scrolling. If you make your users
scroll you are increasing their workload. One way to do this is to add a tab
control to your form and move your controls from the form, to the various
tabs. This helps you organize your data better, and keeps your form to a
size that fits without scrolling.

If you insist on using your oversized form, then add an unbound textbox to
your form. Make its background and border transparent, and give it a width
of zero. Place it in the upper left hand corner of the form, and then adjust
the tab order so that it has tab order zero. This way, when our form opens,
Access will move the cursor to that control, although with a transparent
background and zero width, you won't be able to see the cursor.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
F

Frank Wagner

Dale:

Thanks I think we're closing in on a solution.

The problem occurs because I scale down the form to fit the various
resolutions and computer sizes that my clients use. When they use a 800 X
600 resolution, this brings the controls down quite a bit so they fit the
screen. The problem is that the form itself remains at a larger size than
the controls and the screen. Thus, the now blank parts of the form overlap
the screen. is there any way to bring the form size down so I just covers
the controls regardless of their positions.
 
D

Dale Fye

You can change a forms size programmatically by setting the InsideHeight and
InsideWidth parameters.

me.insideHeight = 6 * 1440
me.insideWidth = 8 * 1440

If you know the control that extends the farthest to the right, you could
use something like:

me.insidewidth = (me.ctrl1.left + me.ctrl1.width + .25) * 1440

and do the same thing for the last control on the form (vertically)

me.insideheight = (me.ctrl2.top + me.ctrl2.height + .25) * 1440

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
F

Frank Wagner

Dale:

I've tried the code you suggested, and it doesn't seem to have any effect.
I've used a number of variations including the simple versions which follow:

Me.InsideWidth = Me.Factor_Horiz * 14760 'Factor_Horiz is the factor
that I use
to reduce
the left position of the right-
most
control
Me.InsideWidth = 10000 'This is just a simple trial with a fixed value

If I follow these statements in the debug mode, they have no effect on the
InsideWidth value. I'm using Access 2000. Is there something that would
lock these values or prevent them from changing any any way?

Also, to make sure we are on the same page, when the resolution is 800 X 600
the controls are squeezed into the screen on the form fine, but there is a
large amount of white space beyond the controls that make the form overlap
the screen and causes problems
 
D

Dale Fye

When I said multiply by 1440, I meant 1440 (that is the number of pixels per
inch), so regardless of what your formatting is, use that number to define
the width of the form.

What you could do is loop through all the controls on your form to compute
the values for the right edge of all your controls, or the bottom edge of all
your controls. Then take the largest one of each of those (add a small edge
factor) and multiply by 1440.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
F

Frank Wagner

Dale:

It seems we're not on the same page. My understanding of what you're
telling me simply isn't working.

If I take a blank form, put a small control on it, but extend the size of
the form beyond the screen in design view. it remains beyong the size of the
screen in actual view regardless of what values I use in the insidewide
statement. I have used

Me.InsideWidth = 3 * 1440
Me.InsideWidth = 1 * 1440
Me.InsideWidth = 10 * 1440

It simply makes no differrence.

In debug mode, as I step through the statements, the InsideWidth remains the
same (in my example at 11520 which is larger than the screen) after
processing each one of these statements.

Either I don't understand what it's supposed to do, or some other setting
is keeping it from causing a difference.

Any help would be appreciated. I'm lost at sea.

Thanks

Frank
 
F

Frank Wagner

Dale:

The problem may be that I have maximized the form, and that may invalidate
the commands you have given me.

I would like to keep the form maximized if I can. Is there any way to
shrink the size of a maximized form, and get rid of the excess space on the
edges of the form that overlap the screen after I have collapsed the controls
for the 800 X 600 resolution?

There may not be.

Your thoughts are appreciated.
 
D

Dale Fye

That would definated do it.

Only thing I can think of is to get rid of the Maximize command and actually
size the form to fit the dimensions of the screen. I'm sure there has to be
an API call that will get you that information, I just don't know what it is.

I generally check my clients screen size before I start development, so I
develop the forms to a size that will fit everyones screen. I do this by
running a very small application (one form) that displays a bunch of command
buttons in the bottom right corner. In the upper portion of the form, I
display a label that I advises them to maximize the Access window, then
requests that they click on the button that is furtherst to the bottom right
of the form, that is fully visible. In the click event for each combo, I
have code that uses the sendobject function to send me an email with the
appropriate window size. I then design my forms for the greatest size that
will fit in all screens.

the other thing you might want to look at is the following web site. It
provides a couple of examples of form resizers:

http://www.mvps.org/access/general/gen0002.htm


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top