Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I hide the database application background shell so only my forms are displayed

Access 2010

How do I hide the database application background shell so only my forms are displayed

by  1DMF  Posted    (Edited  )
If like me you are used to developing many applications in Access and have been used to ticking a box on the startup options in Access 2003, you've probably been pulling your hair out trying to do this simple task in Access 2010.

Firstly I must point out this is not a solution per sae, it is a work round in a specific environment.

MS seem to have made a step backwards with regard to application development in Access 2010 and removed this simple start up option tick box!

So ensure you understand this statement before trying to implement this 'fudge'.

Every form in your application MUST be set to 'pop-up' and [color #ff0000]'modal'[/color] (with the exception of sub-forms)

So if your application requires non-modal forms, you CANNOT hide the Access application DB shell!

OK, so with that in mind, and ensuring ALL your forms are 'modal' simply add the following to the main module (Global Code)

Code:
Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long

This declares a function for use from the windows API "user32" library.

Then in your main form of the application add the following to the 'form_open' form event handler procedure
Code:
    Dim lWin As Long
    lWin = apiShowWindow(Application.hWndAccessApp, 0)

That's it!

It's worth noting you can unhide the DB window with
Code:
    lWin = apiShowWindow(Application.hWndAccessApp, [b][color #ff0000]1[/color][/b])


[color #ff0000]IMPORTANT NOTICE[/color]
Ensure your application has a way of exiting, otherwise you will end up with running background processes of your Access DB!

The easiest way is to put
Code:
Application.Quit

on the 'form_close' event handler of the main application form ensuring that the close button is available on the form!

I then hide/show the main form with
Code:
me.visible = True/False
as appropriate so the main form is only ever closed when the user needs to exit the application.

Of course feel free to use it any way you wish.

Hope this is of use and helps you avoid the wasted hours I spent working all this out!

enjoy 1DMF [2thumbsup]


Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top