If you have ever desired to write a program in MS Access, a must for deploying to users is to hide the MS Access window for the database. Hiding the MS Access window will give the program you spent so much time on that ‘real’ feel when a user accesses it. In my opinion, this is almost a must in deploying MS Access programs and consider it part of my working toolkit.

So the example I’ve provided below is a working copy (as always), but to be honest I had to scale this one down quite a bit. You can perform this operation 100 different ways, so take the time to understand how it works, and I’m quite confident if you have figured out how to write a program in MS Access, you can figure out how to tweak the below and attached. Enjoy!

[download id=”8″ format=”1″]

Hide the MS Access Window

Ok, so this solution is put together from a couple of different components. You should be able to tailor this solution to your own after you get it implemented, it really isn’t too complicated once you get it added.

In my example, it is comprised of 3 areas.
[bullet_list icon=”check”]

  • The VBA function to hide the MS Access Window
  • The macros to be called to hide and restore the window
  • The form in which I will call the macros from

[/bullet_list]

VBA Function to Hide the MS Access Window

Below is a set of three functions that work in conjunction, and is where all the magic takes place in the act of hiding and restoring the MS Access window. To note, in my example I am calling the function via macros, but you can just as easily call the fSetAccessWindow() function directly from VBA. Or another option would be to write a sub routine that calls each of the available options in the function, the choice is all yours.

Calling the Hide & Restore Procedures

Ok, now that you have the functions in place you need to call them in order for them to work. In my example file, I am using them through a macro to hide and restore the MS Access window.

In order to hide the MS Access window within the macro, I’m just calling the function from within using the following: fSetAccessWindow ("Minimize", False, False)

Likewise, in order to restore the MS Access window after being hidden. Again, I’m just calling the function using the following: fSetAccessWindow ("Show", False, False)

In my example, these two macros are being called from within the form open and close properties. If you open the form, the MS Access window will hide, and when you close the form the MS Access window will restore.

Important NOTE!

I’d feel bad if I didn’t tell you this, so here we go. An important note that I always seem to forget myself is to RESTORE the window to a visible state before the user exits out the program. So with this said, make sure that you have good accountability for this within your MS Access program.

Tags: