5 Ways to Set a Default Font on Microsoft Access Forms

If you don't like the default fonts in MS Access, you don't have to change them one control at a time. Here are 5 techniques to simplify the task.

5 Ways to Set a Default Font on Microsoft Access Forms

Reader Huy Truong wrote in with the following question (shared with permission):

I wonder if you could write a QuickTip on making Access default to a font? For example, in Access 2016, the default font for all objects is Calibri but I want to change it to Consolas, as that'd help my customers differentiate between 0 (with a slash like this ø) and O.

Great question, Huy!

Setting Default Fonts by Form and Control Type

Let's start with the lowest level and work our way up.

  1. Go into Form Design mode
  2. Click once on the Text Box button in the Controls ribbon group
  3. Set the default properties you want for Text Box controls on this form
  4. Repeat steps 2 and 3 for the other control types (e.g., Labels, Command Buttons, etc.)

This will only work for the current form you are editing.  Any new forms you create will go back to the original database defaults.  So, while this is good information to know, it's not an ideal solution–especially if you are trying to maintain consistency throughout your user interface.

Setting Default Fonts for All Forms (and Reports)

  1. Create a new form
  2. Follow the steps above and set the Font Name to "Consolas" for the Default Text Box
  3. Save the form as "ConsolasTextBoxes" and close it
  4. File > Options > Object Designers > Form Template: ConsolasTextBoxes
  5. Click [OK] to close the Access Options dialog
  6. Create a new form
  7. Add a text box to the form...the font name defaults to Consolas

In step 2, you can set additional properties for additional control types.

You can also repeat steps 1-7 replacing the word "Form" with "Report" to create and assign an application-wide Report template.

This might seem like the perfect solution, but there are two big drawbacks:

  • Buggy behavior
  • You can only define a single template

I honestly don't remember the nature of the buggy behavior.  It occurred early in my Access development career when I was doing a lot of my development with and for Access 2000.  The buggy behavior may have been fixed by now.  I never found out because the second drawback is worse than the first.

I do not use this method.

Multiple Form and Report Templates

If you think about it, defining a Form and/or Report template does not get you anything you couldn't get by copying and pasting an existing form or report.

  1. Create a form
  2. Set its Default View to "Single Form"
  3. Set Record Selectors to "No"
  4. Set Navigation Buttons to "No"
  5. Save the form as "_Unbound_Template" and close it
  6. Create another form
  7. Set its Default View to "Continuous Forms"
  8. Set the Default Text Box's Add Colon property to "No"
  9. Set the Default Combo Box's Add Colon property to "No"
  10. Save the form as "_Continuous_Template" and close it

To create a new unbound form, select the "_Unbound_Template" form, then press [Ctrl] + [C] (copy) followed by [Ctrl] + [V] (paste).  Enter the name you want for your new form and click [OK].  For a new continuous form, follow the same steps but copy and paste the "_Continuous_Template" form.

This approach is easy, and it completely avoids the two drawbacks of the template approach.  

This is the technique I would recommend for most users.

Make Global Style Changes with Themes

One big downside to all of the approaches so far is that they only affect future forms.  

If we want to make widespread changes to existing forms, those techniques won't help.  This is where Access Themes come into play.  By modifying the default theme style to use a new font, you can potentially apply changes across the entire front-end application.

I know at least one Access developer, Peter Cole, who swears by this approach.  If this interests you, I recommend you contact Peter or at least check out his presentation and/or Access Theme tool (not publicly available as of writing).

I've avoided this approach over the years for a few reasons:

  • Changing a font globally could cause some control values to get cut off
  • You must use theme colors instead of choosing from the entire color palette
  • I don't like the idea of changing things that are already tested and working

Building New Forms (and Reports) in Code

The technique that I prefer is to create and customize forms using VBA.

Here's the subroutine declaration:

Sub DesignNewForm(Optional ByVal IsContinuous As Boolean = False, _
    Optional ByVal IsUnbound As Boolean = False, _
    Optional ByVal IsPreview As Boolean = False, _
    Optional ByVal IsGetForm As Boolean = False, _
    Optional ByVal IsLookup As Boolean = False, _
    Optional ByVal IsUnboundAddForm As Boolean = False, _
    Optional ByVal InsertCode As Boolean = True)

As you can see, I use this one function to create forms for a wide variety of uses.

Here's an excerpt of the code that powers the function:

Const TwipsPerInch As Long = 1440
Dim Frm As Form

Set Frm = CreateForm
With Frm
    .GridX = 16
    .GridY = 16
    .Width = 4 * TwipsPerInch
    If Not (IsPreview Or IsGetForm) Then
        DoCmd.RunCommand acCmdFormHdrFtr
        .DividingLines = True
    End If

    With .DefaultControl(acCommandButton)
        .FontName = "Verdana"
        .FontSize = "10"
    End With
    
    With DefaultControl(acTextBox)
        .FontName = "Consolas"
        .FontSize = "10"
    End With
    
    DoCmd.Restore
    
    'https://nolongerset.com/fun-with-form-windows/
    FillAccessWindow .hWnd, , , 0.5, 0.5
End With

My actual code has grown quite a bit over the years.  It is very particular to our design aesthetic.  As you almost certainly will have a different aesthetic than mine, including all of my code would be a distraction.

The above code should be enough to get you started building your own custom form template code.


Image by Foundry Co from Pixabay

All original code samples by Mike Wolfe are licensed under CC BY 4.0