Hi Everyone!

Apologies in advance for the long thread!

I have an Access database, which I have developed to monitor and track assets issued to employees, and it is intended to be used by others, as opposed to myself. It therefore makes heavy use of forms in order to provide a friendly user interface for non-technical people.

To really polish the application off, I want to be able to completely hide the main Access application window, so from a user's point of view, they would not know it was Access. I have already looked extensively into doing this and the common approach seems to be calling the Windows API: ShowWindow function. I've seen various snippets of code etc on how to do this, but I'm still not 100% sure how it would work with my particular application.

My application consists of a main form, which users can access all the various functionality. This form has been set to load as soon as the database is opened from the Tools>Startup menu, and will be open the whole time the application is in use. Its modal and popup properties are set to False. All other forms are in effect children of this main form and have their modal and pop up properties set to true, and display on top of the main form as and when they're called. I also have a login form, which I've set to open from the Load event of the main form. This is obviously modal and will quit the application if closed, or if the user fails to log on successfully.

Given this setup, how can I successfully use the Windows API mentioned above, if indeed there are no better solutions Initial trials have all resulted in successfully being able to hide the main Access App window, but I get things like the login window appears but the main form is nowhere to be seen, or the main form appears, but the login form can't be seen. In both cases, I had to end the process via Ctrl Alt + Del.

Cheers for any help and sorry for the long winded thread!!

Re: Hiding Access Application Window


Hi, I am actually working on the same problem. But I am new with respect to this programming environment. May I ask how exactly you were able to do what you said. Specifically, hide the database and have the main form remain. Even with the problems you mentioned it would be a step in the right direction for me.

thanks in advance.

Re: Hiding Access Application Window


The common approach seems to be the following. I'm no expert myself, so please treat with caution:

In a module, start by declaring the Windows API function:

Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

You also need to declare the following constants, which you pass to the nCmdShow parameter of the function depending on what you want a window to do:

Const SW_HIDE = 0

The hwnd parameter represents the handle of the window you want to work with. For the main Access application window, you would pass Application.hWndAccessApp, which is a function returning the handle of the current Access application window. If you wanted to hide the main application, you would call the function as follows, first declaring a long variable to assign the function to:

Dim lngVariable As Long

lngVariable = ShowWindow(Application.hWndAccessApp,SW_HIDE)

This code could then be called from a Form_Load event perhaps. Make sure that you perform the opposite of the function to restore Access on the Form_Unload event however, otherwise Access will remain hidden and running after the form has closed and you won't be able to bring it back, unless you kill the process.

I stand corrected on any of this as, like I say, I'm no expert. You'll find that there's plenty of information on the ShowWindow API on the internet, plus loads of code snippets on how you would implement it, of which all the code above has come from.


Re: Hiding Access Application Window



Wierd! I'm sure I replied to your question, but it appears to have been removed. Obviously bad advice.

If you tap ShowWindow into Google, there's loads of information about this API, including code snippets and various implementations.

Good luck!

Re: Hiding Access Application Window


Thanks for the reply Keithyboy1!