Free Lessons
Fast Tips
Topic Index
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > TechHelp > Directory > Access > MoveSize < HasValue Function | Option Group >
Back to MoveSize    Comments List
Setting position on form open Upload Images   Link   Email  
Thomas Gonder       
2 months ago
As mentioned in another thread, I was having all kinds of problems positioning forms properly when they were first opened. It turns out this little bit from MS on the command is quite important:
**Use the MoveSize method to move or resize the active window.**

Putting the docmd.movesize in the Open or Load procedures will not work, because... it isn't yet active! (in fact other forms may get moved instead of the one that is opening).

Luckily, most of my forms used the On Activate event, so that's a good place to put the docmd code. If you want users to be able to reposition the forms, then you'll need to add a variable so that future On Activates don't put the form back to the original start position and size.
Richard Rost             
2 months ago
Or you can use a Timer trick.

Set the Form Open/Load event to:

Me.TimerInterval = 100 ' milliseconds

Now in the Timer Event say:

Me.TimerInterval = 0 ' shut off the timer
' do your move stuff here

This will cause the timer event to run 1/10th of a second after the form loads, do your move stuff, and then shut off the timer event so it doesn't run again. I cover this in a few videos.
Thomas Gonder       
2 months ago
@ Richard, that trick works because the Timer runs after activation, I'll bet. However, I use the Timer in all my forms for checking various conditions. So, while it may work for others not using the Timer for anything special, I still think the best place is in Activation, since one may use Timer in the future. There may be another place to put to docmd.movesize in, but since Microsoft specifically mentioned "active window" I figured go with it. The question I had is if the form is "active" before or after the Activate procedure. So far, the solution seems to be working correctly, but I just know that tomorrow...
Thomas Gonder       
2 months ago
And tomorrow arrived, after lots of testing, and a reboot, Access decided what worked yesterday wasn't going to work today. Specifically, the On Activate stopped working for a startup form (my login). So, for anyone following in my footsteps, you may, for a startup form only, try putting the placement and sizing code in the On Current event procedure (or maybe both if you suffer the same inconsistencies). I don't have any records for Login, so it only runs once. Until tomorrow when On Current stops working and On Activate takes over again...
Richard Rost             
2 months ago

This thread is now CLOSED. If you wish to comment, start a NEW discussion in MoveSize.


The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
My Account
My Courses
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/23/2024 2:19:27 AM. PLT: 1s