• Hiding the Access Window (2003)

    Author
    Topic
    #427386

    I’m trying to hide the Access window on startup using the code specified here but the Access window still comes up.

    Viewing 1 reply thread
    Author
    Replies
    • #990131

      (Edited by Rudi on 14-Dec-05 10:34. Apologies, i misunderstood you. I was initially under the impression you meant the Database Window. Ignore my reply!)

      You do not need code to do this. While in the DB, choose TOOLS | STARTUP. In the Startup dialog, deselect the Display Database Window. This will hide the window at startup.

    • #990132

      This is because you show the Access window immediately after hiding it: the line

      fSetAccessWindow SW_SHOWNORMAL

      is in the exit section, it will ALWAYS be executed. It should be in the error handling section.

      However, I would strongly recommend NOT doing this. In my experience, this code behaves unpredictably. If problems occur, the user may end up with an invisible instance of Access, Explorer may crash, etc.

      • #990133

        You’re right Hans, I’ve put fSetAccessWindow SW_SHOWNORMAL in the error handling section and now, upon startup, nothing at all shows up, you cannot, afterwards, even open the file with the shift key depressed and there’s no trace of the file in the Task Manager Window.

        • #990134

          When you are testing code that automates Access from another application, or code that manipulates the Access application window (such as referred to in this thread), you may inadvertently end up with one or more hidden instances of Access. You can check the Processes tab of the Windows Task manager – look for MSACCESS.EXE.
          If a database is still open in such an instance, you will see a .ldb file that you can’t delete in the same folder as the database.

          Here is how you can close a hidden instance of Access:

          – Start Word or Excel.
          – Open the Visual Basic Editor (Alt+F11).
          – Activate the Immediate window (Ctrl+G).
          – Type GetObject(, “Access.Application”).Quit and press Enter.
          – The .ldb file should disappear from the folder containing the database, indicating that the database has been closed.
          – If not, repeat.

          Note:
          You can use the same method to close hidden instances of other Office applications. Instead of “Access.Application”, use “Word.Application”, “Excel.Application” etc.

          • #990135

            Thank you Hans, the .ldb file disappeared at the first attempt.

        • #992629

          Okay, here’s the deal. Access 2000 and up act differently then Access 97. In Access 97, you could simply use the ShowWindow API to hide the Main Access Window, and all you had to do, is turn on the Popup Property of your forms.

          They made some changes to how they subclass the windows for forms in Access 2000 (and up). Because of this, it was ‘noted’ that you had to also set the Modal Property to Yes, along with the Popup Property.

          That is a problem. It works, but having the Modal property on causes a few problems. According to the help : You can use the Modal property to specify whether a form opens as a modal form. When a form opens as a modal form, you must close the form before you can move the focus to another object.

          That’s a pain. What good does it do to only let one form open at a time?

          A while back, I was on a mission to help someone out with a pet project of theirs. They wanted an Access Form that is ‘Always On Top’. (Like the Task Manager window, above all other windows). Microsoft’s knowledge base lists the way to do this is with a timer on the form, which constantly ‘pushes’ the form to the top…… YECK! . I came up with a better way. No timers, and it works like a charm. In doing so, I discovered a way to get around the Modal property issue.

          I am attaching a sample database that I put together for someone. It does a few things. When it opens, you’ll get frmMain. There are buttons for frmOne and frmTwo. frmTwo will open with a different shape. All the forms will appear on the desktop, and there is a ‘Minimize All Forms’ button, which minimizes the forms, and leaves a ‘bar’ in the Status Bar, so that you can click it to return to the forms (and the Main Access Window stays hidden).

          Note the tricks to the trade with this: When the main form is closed, it unhides Access (won’t leave ghost Access Applications running….though, you can create a simple routine that unhides hidden Access windows….it’s pretty easy….). When a form opens, it calls the ShowWindow API on itself, which is what gets around the ‘Modal Property’ issue.

          Hope this helps!

          Drew

          • #992646

            Hey Drew, that’s really cool. And if you never want to see the Access Window again, you just put Application.Quit in frmMain On Close event. wink
            By the way, do you have an explanation for this?

            • #992658

              No idea on the pivot table thing. Not my ball of wax.. wink

            • #992699

              It’s ok. I still hope someone will help me crack that one.
              Pretty impressive stuff behind frmTwo. You must be an accomplished programmer to know what each API function does in order to properly employ it.

            • #992712

              All of those API’s are in the MSDN. Regions (what you use to shape forms) aren’t that difficult to use.

            • #992716

              Where do you get documentation on those “regions”? Your web site doesn’t open by the way.

            • #992900

              I know, my website has been down for a few months, long story.

              As for docs on regions, look up Region Function in the MSDN library.

    Viewing 1 reply thread
    Reply To: Hiding the Access Window (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: