Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > MoveSize > < HasValue Function | Option Group >
MoveSize
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   3 years ago

Move & Resize Forms with MoveSize in Access VBA


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

In this Microsoft Access tutorial, you will learn how to use the MoveSize command in VBA to program and control the coordinates of forms when opening them. You will explore properties like Left, Top, Width, and Height to read and set the desired location and size of forms. This tutorial is aimed at those with prior VBA knowledge who need to maintain consistent form placement in their Access projects.

Natalie from Carmel, Indiana (a Platinum Member) asks: How can I ensure that my Microsoft Access forms open in the exact location I want them to, even after making design changes? It seems like no matter what I do, Access opens the forms wherever it wants to. Is there a way to use VB code to program the form's coordinates so that it always opens in the specified location?

Members

Members will learn how to create user-defined functions for dynamic form positioning. Whenever you save a form, the position is saved. Open it up, the position is loaded. We'll use a system settings table to keep positions for all forms in the database.

Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. If you're not a member, Join Today!

Prerequisites

Links

Recommended Courses

MEMBER LINKS

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

KeywordsMove & Resize Forms with MoveSize in Microsoft Access VBA

access 2016, access 2019, access 2021, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, MoveSize, WindowTop, WindowLeft, WindowHeight, WindowWidth, VBA command, form coordinates, form placement, consistent form placement, Microsoft Access tutorial, form location, form size, MoveSize in Access, form properties, Left property, Top property, Width property, Height property, reading window properties, setting form location, setting form size, control form opening, VBA programming, form design, design changes, Access form opening, programming form coordinates, Access form coordinates, Access form location, Access form size

 

 

 

Comments for MoveSize
 
Age Subject From
10 monthsMoveSize Global Module Runtime Error 2505Howard Chapell
2 yearsSetting position on form openThomas Gonder
3 yearsMoveSizeMark Budinger
3 yearsMoveSizeJohn Davy
3 yearsHeres a class that does thisGary James

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to MoveSize
Get notifications when this page is updated
 
Intro In this video, we will talk about how to use the MoveSize command in Microsoft Access to control exactly where your forms open and ensure they always appear in the precise location you want, even after making design changes. I will show you how to retrieve a form's coordinates using VBA, and then write code to set the form's position and size whenever it opens. This is a developer-level tutorial using basic VBA in Microsoft Access.
Transcript Welcome to another TechHelp video brought to you by AccessLearningZone.com. I'm your instructor, Richard Rost.

Have you ever had a form that just won't open where you want it? You save its location and you make a design change to save it, and it just won't open there. It won't stay put. Well, in today's video, I'm going to show you how to use the MoveSize command to have a form open exactly in the spot that you want it to open.

Today's question comes from Natalie in Carmel, Indiana, one of my Platinum members. Mmm, Carmel. Yummy. How can I ensure that my Microsoft Access forms open in the exact location I want them to, even after making design changes? It seems like no matter what I do, Access opens the forms wherever it wants to. Is there a way to use VB code to program the form's coordinates so that it always opens in the specified location?

Yes, Natalie, I've had this problem too. I've moved forms, gone to design view, saved the location, gone back to form view, and it pops up wherever it wants. It's a quirk with Access. Ninety-nine percent of the time it works fine, but once in a while it just doesn't go right where you want it to go.

So we're going to use some code to make those little forms go where we want to put them. We're the boss.

This is a developer-level video. What does that mean? That means we're going to use some VBA. If you've never done any VBA programming before, go watch this video first. It's about 20 minutes long and it'll teach you everything you need to know to get started. VBA is not scary, folks. It's not tough. Go watch this and also watch my status box video. This is how I like to display information. Go watch this video too. Instead of using a message box, we can just put messages in a text box on a form. It's really easy to do.

These are free videos. They're on my website and on my YouTube channel. Go watch them and come on back. I'll wait for you. Well, not really hit the pause button and go do that.

Here I am in my TechHelp free template. This is a free database you can download off my website if you want to. Normally in Access, if you move a form, even in form view, you don't necessarily have to make a design view change. But if you hit Control+S, save that form in that location, then close the form and reopen it again, it stays in that location.

Ninety-nine percent of the time this works just fine. Move it over here, hit start up, save it, close it. I got a button up here that opens up the DPN to school over here. Open it up, there it is. Same thing with the customer form. That's its opening spot by default. If I move it, let's say I want it over here, and I hit Control+S, save it, and then close it, and if I open it up again, most of the time it opens up there just fine. But it doesn't always. I've got databases that are pains, and every now and then you make a change somewhere, and this form now starts opening up over here. So we're going to hard code the location that we want this form to appear in with some VBA.

First, in order to do that, we have to get the location. We have to get the coordinates of where this form is. Let's close this guy. Let's do it with the main menu. This is easy enough over here. You can do it with any form though. Go to design view. We'll use our little Hello World buttons here. We'll say Get Coordinates. I'm going to make this a little bit bigger too, so we got some more room here. See what's going on. Right-click, build event, that goes into the code editor. Here we are, right down there.

Now, instead of status Hello World, I want to see the top, left, height, and width properties of this form. To do that, I'm going to say status - that's my status function - Top is going to be, we're going to add onto that, Me.WindowTop. That is the top coordinate of the form. That's how far it is from the top of the inside of the Access window. It's all relative to this little point right there. That's 0,0. My cursor is right there. So this guy is going to be this many from the top down.

Next is the left coordinate: status and then Me.WindowLeft. You can also get the height and the width of the window as well, because you can not only control the location of the form but control its exact size too. I'm just going to copy one of these lines, then paste and put in here the height of the window as well. Me.WindowHeight. And then we got width: Me.WindowWidth. Save it.

Back over here, let's close our form, open it back up again, hit the button, boom, there's your coordinates for this form. Remember what Me does - Me is the current form that you're on. These are all properties of that form.

Save this. I'm going to copy this and I'm going to throw it in Notepad. Let me open up Notepad. There's no paste, head into there. Okay, there's the numbers that we need for our VBA code. I'm going to slide that over to the side now.

What I want to do is when this form opens, in either the On Open event or the On Load event, it really doesn't matter which one, we're going to MoveSize the window to those coordinates. Right-click, design view, go to the properties for the form, go to Events. I already have an On Load event in here. We can jump into that one. I've got a DoStartup function - don't worry about that. In fact, I'm just going to delete it for class; you don't have to worry about that. If you want to download this template and go poke around there and see what it is, that's fine. It's in my Rick's Mod; keep out. It's just stuff to move this window around for me for class.

These are the coordinates that we need right here. I'm just going to copy these and put them back in my code editor. I'll put little remarks in front of it: width, height, left, and top.

Now this is where we say when the form loads, I want you to move to this location and resize yourself. It's the DoCmd.MoveSize command. They put it all together into one command. Now it says right, down, width, height. It's a little confusing because "right" is actually the "left" command. It's how far from the right of the screen are you. It's the same value. So in here, put in 210 - that's your left. Down is how far from the top you are, so the top: 135. Width is 6480 and height is 5760. These are things called twips. I'm not going to go into what they are but just know it's a number you need. You don't have to remember it, just copy it. I have a whole other video on twips and pixels and inches and all that good stuff. Google it on my site.

Save it - always a good idea once in a while - I'm going to throw in a Debug Compile. Debug Compile, good enough. Come back out here, let's close this guy, save changes, yes, and open it back up.

Okay, and it goes to that spot. Let me move it over here, close it, open it back up, and it goes back to that spot. That's nothing new. Let's move it over here, save it in that position (I just hit Control+S), close it, open it back up, and it goes right back where it's supposed to be.

So even if you come in here and make a design change and do something like this, move it, change this, and bring it over here, save it, close it, and open it, it's always going to open up in that exact position where you saved it.

That's how you do it. You just need to know those coordinates - which you can get easily with a little status - and then just tell it where you want it to go and that's all.

Now, that's the basics, and if you're happy with that, great, go forth and play with your database.

If you want to learn more, in the extended cut for the members, what we're going to do is integrate this in with a system table. I already have an extended cut for you guys (new members) where we built a system table to save values for the entire overall database. We can use this to save those settings, those coordinates, for any form in the database. We can put all the forms in the database wherever we want them, save them, and have them automatically open and close where you left off.

So if you decide you want to slide your customer form over a little bit more, when you close it, it'll save its settings automatically, and then when you open it back up again, it's going to start right back where you left it off. If you want that kind of behavior, you can also make a button that says "Save the form here" and it'll save those coordinate positions.

We'll do it with some user-defined functions. We'll make a GetSetting and PutSetting command, and then we'll have a "Save My Form Position" and "Load My Form Position" command. You can do it with any form you want with just two lines of code: one line in the Open event, one line in the Close event.

That's a mouthful. That's in the extended cut for the members. Silver members and up get access to all of my extended cut videos, and of course, Gold members can download all this cool stuff and you have access to my Code Vault where you'll find all this source code plus lots and lots of other stuff.

On a separate, unrelated note, I also have a template available that allows you to open up your Access database exactly where you want it and at what size you want it in Windows. When Access opens up, it can either fit itself here or fit itself there or wherever you want based on the positions that you save. So these are not the forms inside of Access; this is the Access window itself. This requires a lot more programming, so it's not part of a TechHelp video, but it's a template. It's available on my website. Check it out. There's the link right there.

If you like learning with me, come to my website and check out my developer lessons. I've got 40 some levels of all kinds of different developer programs. If you like this kind of stuff and like learning with me, go check it out.

There you go, there is your TechHelp video for today. I hope you learned something. Live long and prosper, my friends. I'll see you next time.
Quiz Q1. What main problem does the MoveSize command solve in Microsoft Access forms?
A. It ensures that a form always opens in the position and size specified by the developer.
B. It automatically resizes controls on a form for mobile devices.
C. It fixes database corruption when forms do not display correctly.
D. It sorts data in a form based on specific coordinates.

Q2. Why might saving a form's location in Access occasionally not work as expected?
A. Access sometimes ignores location changes due to software quirks.
B. Saving only changes the appearance, not the position.
C. Access automatically resets all customized settings on close.
D. Saving changes only applies to reports, not forms.

Q3. Which events can you use in a form to trigger the MoveSize command?
A. On Open or On Load event
B. On Close or On Save event
C. On Click or On Delete event
D. On Format or On Print event

Q4. What is the correct syntax for moving and resizing a form using VBA in Access?
A. DoCmd.MoveSize right, down, width, height
B. DoCmd.MoveWindow left, top, width, height
C. Form.MoveTo top, left, width, height
D. Access.MoveForm horizontal, vertical, size, shape

Q5. What is the purpose of the Me keyword in VBA for Access forms?
A. Refers to the current form instance in which the code is running
B. Indicates the owner of the Access database
C. Points to the previous form that was opened
D. Represents the parent object of the Access window

Q6. What data type are the values for position and size (arguments to MoveSize) commonly expressed as?
A. Twips
B. Pixels
C. Inches
D. Centimeters

Q7. In Access VBA, which property would you use to find how far a form is from the top of the Access window?
A. Me.WindowTop
B. Me.Top
C. Me.ControlTop
D. Me.PositionY

Q8. What would happen if you make a design change to a form after setting its location, but do not implement code to set its coordinates?
A. The form might not open in the location you expect.
B. The form will always remember the last position.
C. The design change is not saved until you restart Access.
D. The form will resize automatically to fit controls.

Q9. For advanced behavior, like having a form always retain its last-closed position, what technique was suggested in the video?
A. Store position settings in a system table and reload them on open.
B. Use built-in Access settings with no code required.
C. Use macros only and avoid VBA.
D. Depend on Windows registry keys.

Q10. What useful functionality can user-defined functions like GetSetting and PutSetting provide?
A. Allow saving and loading custom settings such as form positions automatically.
B. Automatically export data to Excel.
C. Import user preferences from Word documents.
D. Send alert emails when a form changes position.

Q11. What is the main benefit of using a "Save My Form Position" button as described in the extended cut?
A. It lets users save the current form's location to be recalled next time.
B. It prints the form's coordinates onto a report.
C. It creates a backup of the database.
D. It exports the form as a PDF with position settings.

Q12. What is an alternative way to show messages to the user, as recommended in the video?
A. Display them in a status box text field on the form.
B. Use message boxes exclusively for feedback.
C. Always send all messages to the Windows Event Log.
D. Display messages in the Windows taskbar tooltip.

Answers: 1-A; 2-A; 3-A; 4-A; 5-A; 6-A; 7-A; 8-A; 9-A; 10-A; 11-A; 12-A

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary Today's TechHelp tutorial from Access Learning Zone covers how to control exactly where a Microsoft Access form opens using the MoveSize command in VBA. Many of us have faced the frustration of setting a form's location, saving it, and finding it reopens somewhere else after making design changes. Even after carefully saving the form in the desired position, Access sometimes does not remember and puts the form wherever it wants. Today I will outline how to solve this problem with a little bit of VBA, giving you full control over your form's placement.

This issue was brought up by a student who wanted to know how to guarantee that a form always opens in the exact spot she specifies, regardless of any modifications made in design view. I have encountered this myself. Access usually gets it right, but occasionally it forgets the location, especially after making design changes. The best solution is to programmatically set the position using VBA so the form opens exactly where you want, every time.

Since this is a developer-level lesson, we will use VBA. If you are new to VBA programming, I recommend first checking out my beginner videos on VBA and on creating a status box to display messages inside your forms. Both of these are available for free on my website and YouTube channel and will help you get comfortable with the concepts if you're just starting out.

I am using my TechHelp free template for this demonstration, which you can also download from my website. Most of the time, simply moving a form and saving it with Control+S works. You close and reopen the form, and it stays put. However, there are those occasional situations where a form stubbornly refuses to stay in the intended spot. To guarantee the position, we need to use VBA to hard-code the window's coordinates.

The first step is to get the current coordinates of your form. This includes the top and left positions, as well as its height and width. You can do this by adding a button to your form that displays these properties using the Me.WindowTop, Me.WindowLeft, Me.WindowHeight, and Me.WindowWidth properties. After running the code to display these coordinates, copy them down somewhere safe, like Notepad.

With your coordinates in hand, you need to tell the form to position itself at those values whenever it opens. This is done by placing a MoveSize command in the form's On Load (or On Open) event. Paste your coordinates into the code, making sure they are in the correct order: left (called "right" in the command), top (called "down"), width, and height. These values are measured in "twips," which is simply a unit of measurement used by Access. You do not need to understand twips in depth; just use the values as provided.

After inserting the MoveSize command with your recorded coordinates, save your changes and close the form. Open it again and it will appear exactly where programmed. From now on, even after making design adjustments or moving the form around, reopening it will place it in your chosen position.

This is the basic method, and for many users this is all you will need to ensure your forms open where you want. However, for those who want even more flexibility, I offer an expanded technique in the Extended Cut for members. In that section, I show how you can store each form's position in a system table with fields for each form's location and size preferences. By combining user-defined functions to get and set these settings, you can make every form in your database remember its position automatically. You can also add buttons to forms so users can save and recall their form positions without writing any extra code. With just two commands in the form's Open and Close events, you gain full control over form placement across the whole database.

For those who are interested, I also have a template available on my website that lets you control the entire Access application window's placement on your screen at startup, not just the forms inside it. This task involves more advanced programming but is available for download if that meets your needs.

If you enjoy learning Access development, I encourage you to check out my full set of developer lessons on my site. There are many levels available, covering all sorts of topics from beginner to advanced.

You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends.
Topic List Using DoCmd.MoveSize to position Access forms

Retrieving form coordinates with VBA

Displaying form coordinates using a status box

Understanding Me.WindowTop Me.WindowLeft Me.WindowHeight Me.WindowWidth

Setting form position and size in the On Load event

Copying coordinate values for VBA usage

Forcing form to open in a specific location every time

Distinguishing between saving form position manually and with VBA

Explanation of coordinate units (twips)

Practical demonstration of persistent form positioning
 
 
 

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

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

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/7/2026 12:43:10 AM. PLT: 1s
Keywords: TechHelp Access Access 2016, Access 2019, Access 2021, Access 365, microsoft Access, ms Access, ms Access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, MoveSize, WindowTop, WindowLeft, WindowHeight  PermaLink  Move & Resize Forms with MoveSize in Microsoft Access VBA