Suppose you’re building an application in MS Access, and your user interface consists of only one form. You don’t want to show the main application window, just the form you’ve designed. The most obvious way to do this is by making your form a popup form and do a call to the Windows API

from the Form_Open event to hide the main Access window. This will work, but there is a catch. Your application won’t be visible anymore in the windows taskbar and will easily get lost behind other programs.

A better way is to not hide the main Access window, but to resize it and position it behind your form. Put the following code in your form’s VBA module.

When your form is opened, the dimensions of the main window are stored for future reference. Then it’s size and position are set to match that of your form’s. Also note that an icon for the form is loaded from file.

Because a form can be dragged across the screen we need to check if it’s position has changed. This is done using a timer. Set the form’s timer interval to about 100 milliseconds and place the following code in the form’s On Timer event procedure:

To make these API calls work, you need to put the following declarations and constants in a separate module

Happy coding!

Aswin van Woudenberg

I'm a lecturer at the NHL Stenden University of Applied Sciences where I teach Artificial Intelligence, Algorithms and Concurrent Programming. Together with my students I'm building dialogue systems that can learn, reason and converse in a variety of domains.


heylina · May 13, 2007 at 11:50 am

can you please give a database example . coz when i try and do the instructions.. it’ll not work for me.. thnx alot

Aswin · May 14, 2007 at 8:21 am

I just put a database example online. You can download it from here:

Heylina · May 15, 2007 at 2:45 pm

thnx alot for the reapply… i appropriate it… 🙂

Heylina · May 15, 2007 at 2:49 pm

wow.. ive it in my Database, and it really works.. thnk you very very much it did solve my problem. and its very informative

ENRICO · August 19, 2015 at 10:44 am


Leave a Reply

Your email address will not be published. Required fields are marked *