Hide Access Window and Still Show Popup Form

Posted on 2012-08-19
Medium Priority
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 http://access.mvps.org/access/api/api0019.htm (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
  • 3
  • 2
LVL 49

Accepted Solution

Dale Fye earned 2000 total points
ID: 38311351
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

ID: 38311873
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 49

Expert Comment

by:Dale Fye
ID: 38311935
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

ID: 38311973
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

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

850 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