Go Back   Access World Forums > Microsoft Access Reference > Code Repository

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-06-2018, 09:52 AM   #1
Frothingslosh
Premier Pale Stale Ale
 
Frothingslosh's Avatar
 
Join Date: Oct 2012
Location: Flint, Michigan, USA
Posts: 2,911
Thanks: 74
Thanked 404 Times in 365 Posts
Frothingslosh will become famous soon enough Frothingslosh will become famous soon enough
Colored Background For Windows View in A2016

Here's something someone might find useful.

I don't know about Access 2013, but in Access 2016, Microsoft, in its infinite wisdom, decided to limit the color themes available in Access. Unlike the rest of the Office suite, there is no longer a color theme available that turns the Access background color to something other than bright white.

My office recently upgraded from Office 2007 to Office 2016, and as a result, a number of my users started reporting serious eye fatigue and even a number of recurring migraines because of this change.

One way to avoid this issue is to switch to using tabs instead of windows, but I dislike this solution both because of aesthetics (I and most of my users HATE the tabbed documents look), and because it takes away some of my control over what users see. Because of that, I wound up coming up with this: a simple background form that automatically sizes itself to fit the display area, and if accidentally clicked, takes steps to ensure it remains in the background.

Here is the code behind the form:

Code:
'*********************************************************************************
'** MODULE:         frmBackground
'** CreatedBy:      Scott L Prince
'** CreationDate:   8/4/2018
'** Description:    Provides application background in place of Access White.
'*********************************************************************************
'** THIS FORM AND CODE MAY BY USED FREELY AS LONG AS THIS COMMENT BLOCK REMAINS IN PLACE AND CREDIT GIVEN.
'*********************************************************************************
Option Compare Database
Option Explicit
 
Private Sub Form_Activate()
    
    'Show all OTHER forms that are flagged as visible.
    Call ShowLoadedScreens
    
End Sub
 
Private Sub Form_Load()
    
    'Resize the form.
    Call SetBackground
    
End Sub
 
Private Sub SetBackground()
'*************************************************
'Version:               1.0.0
'Created By:            Scott L Prince
'Date Created:          8/4/2018
'Purpose:               Resizes frmBackground to precisely fit the application window.
'Parameters:            None
'Returns:               N/A
'Dependencies:          None
'Comments:              None
'*************************************************
Dim WH As Long
Dim WL As Long
Dim WT As Long
Dim WW As Long
 
    With Me
        DoCmd.Maximize
        WT = .WindowTop
        WL = .WindowLeft
        WH = .WindowHeight
        WW = .WindowWidth
        DoCmd.Restore
        Call .Move(WL, WT, WW, WH)
    End With
 
End Sub
 
Private Sub ShowLoadedScreens()
'*************************************************
'Version:               1.00.00
'Created By:            Scott L Prince
'Date Created:          8/4/2018
'Purpose:               Displays all OTHER forms flagged as visible.
'                       Displays all opened reports and queries.
'Parameters:            None
'Returns:               N/A
'Dependencies:          None
'Comments:              None
'*************************************************
Dim frm As Form
Dim rpt As Report
Dim obj As AccessObject
 
    'Show all loaded forms that are not this form.
    For Each frm In Application.Forms
        If frm.Visible And Not (frm.Name = Me.Name) Then frm.SetFocus
    Next
    
    'Show all loaded reports.
    For Each rpt In Application.Reports
        DoCmd.SelectObject acReport, rpt.Name
    Next
    
    'Show all open queries.
    For Each obj In Application.CurrentData.AllQueries
        If obj.IsLoaded Then DoCmd.SelectObject acQuery, obj.Name
    Next
    
ProcExit:

    If Not obj Is Nothing Then Set obj = Nothing
    If Not rpt Is Nothing Then Set rpt = Nothing
    If Not frm Is Nothing Then Set frm = Nothing
    Exit Sub
 
ErrHandler:

    MsgBox "An error has been encountered." & vbCrLf & vbCrLf & _
           "Procedure:" & vbTab & Me.Name & "ShowLoadedScreens" & _
           "Error Number:" & vbTab & Err.Number & vbCrLf & _
           "Description:" & Err.Description, vbCritical, "ERROR"
    Resume ProcExit
 
End Sub
Using it is pretty straightforward:
  • Create a form with the background of your choice. (I went with a light blue because...reasons.)
  • Include this code in the form, and save it.
  • Create a startup procedure in a general module that opens the background form, THEN opens your main menu.
  • Create a macro named AutoExec.
  • In that Macro, use the RunCode action, and have it run your startup procedure.
For those who just want to download and go, I've attached two Access 2016 databases:
  • BGForm.accdb
  • BGFormExample.accdb
The first one contains just the background form and nothing else. The other is a full-blown demo so you can see the implementation.

The databases SHOULD open for Access 2013, but you might be out of luck if you have Access 2007 or 2010. Then again, if you use those earlier versions, then you shouldn't need this form anyway. If you do want to use this anyway, you'll probably need to create your own form and copy my code.

Anyway, this isn't a clever solution to a pressing problem, a much-desired feature not built into Access, or a way to push Access beyond its intended boundaries. It's just something your users may appreciate, especially if any of them get migraines from looking at a white background all day.

As per forum rules, if you have any questions regarding this, you're best off posting a PM. If you do reply to this post, please remember to Report this post with the report icon in the bottom-left corner of the post. This is a moderated forum, and without that, your post may well never be approved.
Attached Files
File Type: accdb BGForm.accdb (476.0 KB, 25 views)
File Type: accdb BGFormExample.accdb (672.0 KB, 37 views)

__________________
This is a test.
This is only a test.
If this were a real emergency, you would NOT have been informed, and we would have fled screaming in terror.

Last edited by Frothingslosh; 08-06-2018 at 11:31 AM.
Frothingslosh is offline   Reply With Quote
Reply

Tags
background color , backgrounds , form

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Yes / No Field check mark A2016 Dick7Access Forms 3 01-11-2017 03:27 PM
Windows Explorer background colour StephenSLR Windows 0 01-04-2010 06:06 PM
change background picture of access windows marianne General 4 04-23-2009 09:56 PM
need help to invoke windows explorer in background from excel using VBA SK-2006 Modules & VBA 2 06-08-2007 07:47 PM
Can't view fields with background color esskaykay Forms 4 02-08-2005 07:44 AM




All times are GMT -8. The time now is 03:08 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World