Hiding Access window with doCmd.runCommand acCmdAppMinimize

vbaDev

Registered User.
Local time
Today, 13:23
Joined
Feb 26, 2007
Messages
64
Ok, I finally have it working the way I like. It's really slick - the main form (set to "PopUP" and with docmd.runcommand accmdappminimize line in the On_Open event) opens with customized icon (in titlebar and in windows taskbar) and behaves like a standalone program (you only see Access the first few seconds during opening before it's minimized).

The form can be minimized to windows taskbar and clicked to restore it (form's maximize button is disabled, for appearance sake). it can also be accessed via the alt-tab windows menu, where it also appears with a custom icon. so it's really slick, it behaves just like a standalone app. read on for the ", but..."

I also wrote 2 functions to handle reports.

1st (fnOpen, I also use it for forms, etc. via arguments, but only the reports have the following logic). This one closes my main form, maximizes Access (which has all menus/toolbars disabled, so it doesn't really look like Access, looks like a report viewer). This function is placed into all report buttons' On_Click event with report name as argument and object type (3 for report, because 0=table, 1=query, 2=form, 3=report in my fnOpen).

2nd. (fnCloseReport) is placed into all reports' On_Close event. This function opens my main form again on the tab from which report was called. It works, but herein lies the problem: after the form reopens, it no longer has the whole application's custom icon, but the Access "form" icon. And after this, if minimized to windows taskbar it actually minimizes as resized mini-window above the Start button (as has been described by others, just as it would within Access it it were visible) and Access appears minimized in the windows taskbar, so somehow the whole cool "standaloneness" is turned off.

I wonder if anyone has some suggestions for this. I spent some time researching and testing this and really like the functionality. When the form is displayed without Access, it cannot be right-clicked (at all), which is very useful (although I know there are other ways of protection).

BTW, all my other windows (all popup/modal) appear on top of the main form with no problems. I have "File Open" and "Save As" windows common dialogs that my app calls (via API) and I also have a custom form acting as dialog box (I use the acDialog intrinsic constant when I open it from code). so mutliple windows are not an issue as some have suggested.

Thanks in advance!
 
I found answer to my question through further tinkering.

I wrote a Public Funtion fnMaximize() with only 1 line: "docmd.maximize" in a separate (not behind-form) module (I have it where I also have the fnCloseReport function). Then, if I use this function in the On_Open event of each report, opening that report does not "reset" the "standaloneness" of my app! (you type "=fnMaximize()" in the On_Open field of Property Sheet of report).

I am now 100% satisfied with this feature! I consider it fully implemented, although as per other discussions, if I had a lot of reports, it'd be a pain to configure them all. But in this case I don't!

Thanks, all!
 
Last edited:
Glad to hear it's working for you.
 

Users who are viewing this thread

Back
Top Bottom