Results 1 to 13 of 13
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hiding the Access Window (2003)

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

  2. #2
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hiding the Access Window (2003)

    <P ID="edit" class=small>(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!)</P>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.
    Regards,
    Rudi

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hiding the Access Window (2003)

    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.

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

    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.

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

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

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Get rid of a hidden instance of Access (A2K and >)

    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.

  7. #7
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

    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

  8. #8
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

    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. <img src=/S/wink.gif border=0 alt=wink width=15 height=15>
    By the way, do you have an explanation for this?

  9. #9
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

    No idea on the pivot table thing. Not my ball of wax.. <img src=/S/wink.gif border=0 alt=wink width=15 height=15>

  10. #10
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

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

  11. #11
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

    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.

  12. #12
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

    Where do you get documentation on those "regions"? Your web site doesn't open by the way.

  13. #13
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding the Access Window (2003)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •