Stylish Checkboxes & Toggle Buttons in MS Access
The standard checkbox in Access is small, grey, angular – and somehow lifeless. With a little VBA you replace it with a command button featuring a real icon, hover effect and lots of interactivity. Here are two simple ways.
We all know that the standard controls in Microsoft Access aren’t particularly stylish – especially the checkbox. Sometimes we look longingly at modern web applications, where everything is smooth, interactive and stylish. But Access can do more than it seems at first glance.
With a little code and clever use of existing functions, you can replace a boring checkbox or toggle button with a command button – with an icon, hover effect and lots of interactivity.
Why a command button?
- Any icons (even dynamic ones at runtime)
- Size adjustment – from mini to mega buttons
- Hover functions and visual feedback
- More interaction and a modern look
- Free design for states such as ON/OFF, LOCK/UNLOCK, SHOW/HIDE
A checkbox, by contrast, is… well, quite limited: small, grey, angular – and somehow lifeless. 😅
Example 1: Replace the checkbox
What you need:
- a suitable icon (from the hidden MSysResources table),
- an additional command button that controls the checkbox,
- and a few lines of VBA.
The idea: the button is clicked → the value of the (hidden) checkbox is toggled → the picture is changed. Everything in one procedure in the form:
Private Sub cmdShow_Click()
' toggle the value (True/False)
Me.chkShow.Value = Not Me.chkShow.Value
' change the icon (thanks to Alessandro Grimaldi)
Me.cmdShow.Picture = IIf(Me.chkShow, "show_ON", "show_OFF")
End Sub Example 2: Toggle with multiple states
With a text box as a status memory and a command button, you can cycle through any number of states – e.g. 1 → 2 → 3 → … → 16 → back to 1.
Private Sub cmdIcons_Click()
tboIcons = (Nz(tboIcons) Mod 16) + 1
' we could use a Switch expression here instead of the function
SetMyControlImage_ICONS Me, Me.cmdIcons, Me.tboIcons.Value
End Sub The function sets the matching icon depending on the number:
Public Sub SetMyControlImage_ICONS(frm As Form, ctr As Control, ctrValue As Integer)
Select Case ctrValue
Case 1: frm.Controls(ctr.Name).Picture = "switch_ON"
Case 2: frm.Controls(ctr.Name).Picture = "switch_OFF"
Case 3: frm.Controls(ctr.Name).Picture = "check_ON"
Case 4: frm.Controls(ctr.Name).Picture = "check_OFF"
Case 5: frm.Controls(ctr.Name).Picture = "lock_ON"
Case 6: frm.Controls(ctr.Name).Picture = "lock_OFF"
Case 7: frm.Controls(ctr.Name).Picture = "show_ON"
Case 8: frm.Controls(ctr.Name).Picture = "show_OFF"
Case 9: frm.Controls(ctr.Name).Picture = "no1"
Case 10: frm.Controls(ctr.Name).Picture = "no2"
Case 11: frm.Controls(ctr.Name).Picture = "no3"
Case 12: frm.Controls(ctr.Name).Picture = "no4"
Case 13: frm.Controls(ctr.Name).Picture = "facebook"
Case 14: frm.Controls(ctr.Name).Picture = "linkedin"
Case 15: frm.Controls(ctr.Name).Picture = "pinterest"
Case 16: frm.Controls(ctr.Name).Picture = "youtube"
End Select
End Sub The icons live in the hidden MSysResources table. Show it via right-click → Navigation Options → Show system objects. There you can store your own icons and make your design unique.
Conclusion
With minimal effort you not only expand the functionality of your Access forms, but also modernize their appearance and interactivity. This makes Access exciting, lively and, above all, user-friendly again.
Thanks to Alessandro Grimaldi for the hint to use the IIf expression and for an easy way to toggle numbers. In the download I show various techniques for changing the icon – directly in the form or as a reusable function.
Download
Replace checkboxes and toggle buttons in MS Access with style – a command button with icon, hover effect and multiple states, driven by VBA and the MSysResources.




