Create Theme-Aware Forms in Access

isladogs

Access MVP / VIP
Local time
Today, 04:04
Joined
Jan 14, 2017
Messages
19,376
When distributing applications, a common request is for the appearance of Access forms to be automatically updated in line with the currently selected Office UI theme. The attached database demonstrates one way that this can be done. It includes all required code.

From Office 2016 onwards, Office applications have provided four different Office themes: Colourful, White, Black and Dark Grey with the default being Colourful. It is also possible to specify Use System Settings so that the Office theme is based on the Windows theme:
Windows Light theme maps to Colourful; Windows Dark Theme maps to Black.

NOTE: Office themes alter the appearance of the user interface.
They are not the same as Access themes which can be used to alter the appearance of Access forms and reports
In this case, I am using the Office theme to update the appearance of Access forms.

In order to create forms whose appearance is automatically updated with the Office theme, it is first necessary to get the Office UI theme using code.
This is done by reading the registry key: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\UI Theme.

Office UI Theme NameOffice UI Theme Value
Dark Grey3
Black4
White5
Use system settings6
Colourful7

I then use a series of functions on Form_Load which update different form components (mostly) using the Fluent UI theme colours.
The Refresh Form button will update the form if the theme is changed after a form is loaded.

Note that the purpose here is to show what can be done rather than follow strict fluent UI guidelines. The colours can be changed to suit individual preferences

Here are the results for two forms using the default Colourful theme

1768586561865.png


And again, this time in Dark Grey theme

1768586616123.png


And again in White theme:

1768586727862.png

And finally in black theme:

1768586676651.png


For a more detailed explanation of the process and code used, see my recent article:

I have also created a short YouTube video showing this in action:
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom