Repositioning an Access Form

hk1

Registered User.
Local time
Today, 02:52
Joined
Sep 1, 2009
Messages
121
I've figured out how to reposition an Access form but I have a new problem.

I have one form I'm using mostly for testing right now. When the user closes it, I'm saving the width, height, top, and left, so I can position it at the same place the next time they open the form.

However, if the user moves the application to his laptop and opens it on there, I want to detect that the form is out of the viewport and bring it back inside the viewport.

You would think I could just calculate this but Access has this thing where WindowTop is at 0 when it's positioned directly underneath the menu bar and ribbon. WindowLeft is at 0 when the form is positioned directly to the right of what I call the "Object Viewer". If I take the WindowWidth and add it to WindowLeft, I'll be as many twips off as the object viewer is wide.

Anyone know a way I can tell where the far left top corner is in an access application (since it isn't 0)?
 
A form cannot overlap the "Objects Browser" or Navigation Pane (as it's called). So what do you really want to achieve here?
 
I want to detect if the form is off the screen on the right hand side. More specifically, I want to detect if the settings that were saved for the position of that form will push it outside of the viewable area.
 
Also, I disagree with the statement that a "form cannot overlap the Navigation Pane". It might be desirable for it not to overlap but I'm using access 2007 and it's technically possible for it to overlap. It just puts the WindowLeft property into a negative zone.
 
I want to detect if the form is off the screen on the right hand side. More specifically, I want to detect if the settings that were saved for the position of that form will push it outside of the viewable area.
You could open your form in hidden mode, maximise it, get the window width and save it into a variable. Then open your form in normal mode, resize, and compare the window width variable with the left + width of the form.

Also, I disagree with the statement that a "form cannot overlap the Navigation Pane".
By that I mean stay on top. It can go under, like you know.
 
Your idea is a working solution. Thanks
 
Goodie. Glad you got the gist of it and got the coding right. Good job!
 

Users who are viewing this thread

Back
Top Bottom