Mendip Data Systems

Database applications for businesses and schools

LogoTransparent

Control the Application Interface

Version 3.44    Updated 14/01/2020              

 

This example shows how the Access application interface can be controlled in various ways

Some of these methods can be used to help make a database more secure.

 

The database is opened with a form 'floating independently' on the desktop i.e. with the access application window hidden

 

Buttons on the form can be used to:  

   •  drag a borderless form to a new position

  • show / hide entire Access application window

  • show / hide navigation pane

  • show / hide ribbon

  • show / hide taskbar

  • maximise the form to fill the entire screen (no title bar & no taskbar) - this only works for a popup form

  • open another form with a related report. This shows how the print preview ribbon can be displayed whilst the report is open & hidden when it is closed

  • open / close the Visual Basic Editor (VBE)

 

Although it is highly unlikely that any single application would need to use all of these features, this is designed to show that all items can be toggled on / off independently without problems.

 

All code has been fully tested in Access 2010 & 2016 (32-bit & 64-bit) and has been widely used in various production databases for several years.

 

The code used can be found in the modules:

  • modDatabaseWindow / modNavPaneTaskbar / modRibbon

 

Some of the code is widely known e.g. hide navigation pane / ribbon.

Other parts are written by myself or other authors. Where appropriate, those authors have been acknowledged.

 

This example database also includes:

  • code to resize forms for any screen size & resolution in module modResize

  • additional functions in module modDesignFeatures

 

If you wish to use any of the code in your own projects, just copy the relevant module code including all author information as supplied

 

The VBA reference Visual Basic for Extensibility is required for certain additional functions listed in the module modDesignFeatures

e.g. CloseAllVBEWindows and for getting the procedure names in error handling code.

It can be omitted if you don't wish to use either of these

 

UPDATES:

v2.0      09/05/2018 - added code to shows ways of running a query with the application interface hidden

v3.0      02/01/2019 - added code to open a report with the application interface hidden

v3.2     13/02/2019 - fixed an issue in 64-bit Access

v3.3     04/04/2019 - added code to allow form to be dragged using mouse down event

v3.41   19/07/2019 - modified code to prevent application window being restored after clicking on taskbar icon

v3.44   14/08/2019 - various bug fixes related to code in previous update

v3.46   14/01/2020 - added additional methods of handling reports when application window is hidden

 

     

Click to download:          SetWindows v3.46            (zipped - approx 2.0 MB)

Click the image to view a larger version ...

Screenshot

Return to Example Databases Page

Example Apps for Businesses, Schools & Personal Use

SetWindows_v3.3

RELATED APPLICATIONS

 

Here are several more variations which were suggested by various Access forum members but which may be useful to others. Each should work in both 32-bit & 64-bit Access

 

 

1. Title Bar Only 

This was requested by Utter Access member tina_t via a private message

The OP wanted the application window to be retained but with the title bar only - no nav pane or ribbons:

 

i) This approach works best with overlapping windows.

ii) The form MUST be a popup

 

Click to download:           TitleBarOnly                      Approx 0.5 MB (zipped)

 

 

 

2. Modal forms

This was written in response to a very old thread at Access World Forums where AWF member tonyluke had  issues using modal forms when the application window was hidden. As stated in that thread, doing an action such as transfer database with

a modal form running will make the navigation pane visible if it was hidden.

 

For most purposes, this is useful behaviour so you can check if the action has worked

But where you need it to remain hidden, you can use code to hide the nav pane again immediately

 

However this behaviour won't occur if you also hide the entire application window

 

The example FE/BE databases attached should be saved in the same folder

The BE just has a dummy table to test for linking

The FE contains a modal form with the application window hidden by default

 

i) Click the Link Table button - the nav pane remains hidden

   Click the button again to delete the linked table

ii) Click the Show Navigation Pane button then click the Link Table button

 

Click to download:           TestModal                         Approx 1 MB (zipped)

 

   

 

3. Remove Title Bar Buttons 

Requested by Access World Forums member joeyd11ph in the thread Shutdown PC through Access button

 

The OP wanted all buttons removed from the title bar in order to control Access closedown via code only.

 

i) This approach only works with overlapping windows.

ii) The form MUST be a popup with NO control box, close, max/min buttons

iii) To remove the title bar as well, set form border style to None

 

Click to download:          RemoveTitleBarButtons    Approx 0.5 MB (zipped)

 

 

In addition, he wanted to know how to do other actions such as log off or shut down the PC completely using VBA for which I supplied the following code. Place it in a standard module

Option Compare Database

Option Explicit

 

'NOTE switches used below

/s = shutdown

/r = reboot

/l = logoff

/f = force apps to close without warning

/t xxx = time delay of xxx seconds e.g. /t 2

 

' ‘*******************SHUT DOWN*********************

Public Function TurnOff()

   

   Shell "shutdown /s /t 2", vbHide

   Application.Quit

End Function

 

' ‘*********************REBOOT***********************

Public Function Reboot()

   Shell "shutdown /r /t 2", vbHide

   Application.Quit

End Function

 

' ‘*********************LOG OFF***********************

Public Function LogOff()

   'omit /t switch or it doesn't work

   Shell "shutdown /l", vbHide

   Application.Quit

End Function

 

'‘**********************FORCE************************

Public Function ForceReboot()

   Shell "shutdown /r /f /t 3", vbHide

   Application.Quit

End Function