Hide Access Window and Still Show Popup Form

Posted on 2012-08-19
Last Modified: 2012-08-21
I have found and adapted code that will shrink the main Access window behind my startup popup form, so that the user is not distracted by the underlying Access window. The code uses user32 library functions and ultimately uses SetWindowPos to reduce the Access window size to 5% of its full size.  When closing the startup form, code includes the user32 library ShowWindow function to maximize the Access window. It works like a charm, except that the small Access window can be seen if one moves the currently visible popup form.

I've also seen similar code that claims to HIDE the main access window while still showing the popup form. That code uses user32 library funtions and ultimately uses the user32 library function ShowWindow function with the SW_HIDE (=0) paramater. The claim is that this hides the Access window and still allows the active form to be used. An example I've seen in several places on the web is at (code by Dev Ashish), where the key claim is: "This same function can also be used to completely hide Access window and just show your form on the desktop.  Make the form popup and from it's Open Event, call the fSetAccessWindow function with SW_HIDE as the argument."

I'm using Access 2010. When I follow these suggestions to the letter, both the Access windows and the popup form disappear, and I have to run a stand-alone module, outside the code that's supposed to run in the application I'm developing, to re-show both the Access window and the pop-up form.

Did the code to HIDE the Access window work prior to Access 2010 (or prior to Access 2007)? Or was the original "solution" not a working solution at all? Or is there something else I can do?
Question by:Pelegrinus
    LVL 47

    Accepted Solution

    I have not tried this in 2010, but try setting the forms Popup property to true.

    If that doesn't do it alone, then also set the Modal property to true.

    You should find these properties on the Other tab of the properties dialog.

    Author Comment

    Thank you. I had already set the forms to popup mode, thinking that was enough. It appears that I must also set all forms both to popup and modal, as you suggested. With that, the application runs as if it were a stand-alone app.

    I pass on the caution I've seen about using SetWindow SW_HIDE: If an error occurs in the code, the Access window does not reappear automatically. This is not a problem in runtime mode, because I don't want the Access window to show at any time. But it could be a problem during development. The recommended solution: in the error-trap code, include code to re-show the Access window. I'm not sure how practical that is for me at this stage of development, but I'm keeping it in mind.

    Thanks again.
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    If you don't disable shortcuts, you can always use CTRL-G to open a code window, but your users won't have this functionality, and failure to have really good error handling could leave Access open in the background with no way to close it but the Task Manager.

    I've used this for a couple of simple applications, but rarely use it any more.

    If you don't mind my asking, why a "B".  What could I have done differently to get an "A"?

    Author Comment

    Fair question about the "grade." I thought (and think) I was being complementary and grateful with the middle grade. I think I reacted, in part, to your comment that you hadn't tested your response in Access 2010, as well as to the part of the solution that suggested using popup mode--in my question, I had said several times that I was using popup mode. But your suggestion re the modal mode was exactly what I needed, and I do appreciate your response!

    Author Comment

    Yes. I'll regrade. My misunderstanding of the grading process.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now