> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Modern Message Boxes in Access
- URL: https://nolongerset.com/modern-message-boxes/
- Published: 2022-01-06T03:23:45.000Z
- Updated: 2026-05-08T13:00:24.000Z
- Description: These modern message boxes from Kevin Bell will help set your Access applications apart from the crowd.
- Author: Mike Wolfe
- Tags: Form Design, #Import 2026-05-20 02:59

If you are looking to modernize the look and feel of your Access applications, sprucing up the message boxes that you use will have a big impact.

With Windows Vista (remember when that was still new?), Microsoft introduced [task dialogs](https://docs.microsoft.com/en-us/windows/win32/controls/task-dialogs-overview) as part of the [Common Controls library](https://docs.microsoft.com/en-us/windows/win32/controls/common-controls-intro) (comctl32.dll). Here's an example of a task dialog from the Microsoft documentation:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/01/image-12.png)

As this is a COM library, its properties and methods are available to us via API calls in VBA. Here are the two primary functions that allow us to create these forms:

```vba
    Private Declare PtrSafe Function TaskDialog Lib "comctl32.dll" ( _
            ByVal hwndParent As LongPtr, _
            ByVal hInstance As LongPtr, _
            ByVal pszWindowTitle As LongPtr, _
            ByVal pszMainInstruction As LongPtr, _
            ByVal pszContent As LongPtr, _
            ByVal dwCommonButtons As Long, _
            ByVal pszIcon As LongPtr, _
            pnButton As Long) As Long

    Private Declare PtrSafe Function TaskDialogIndirect Lib "comctl32.dll" ( _
            pTaskConfig As TASKDIALOGCONFIG, _
            pnButton As Long, _
            pnRadioButton As Long, _
            pfVerificationFlagChecked As Boolean) As Long
```

To say the above code is just the tip of the iceberg, though, is a major understatement. 

The full code required to get even a simple task dialog working requires declaration of tons of constants, user-defined types, enums, and additional API function calls. Plus, you need to make sure that everything works in both 32-bit and 64-bit versions of VBA.

Whew, that sounds like a lot of work!

## Work Smarter Not Harder

As it turns out, it *IS* a lot of work!

The wonderful news, though, is that someone has already done all of that hard work. Actually, some *ones* have done all that hard work.

- **Jon Johnson** (a.k.a., fafalone) posted the original VB6 code at [vbforums](https://www.vbforums.com/showthread.php?777021)
- **Kevin Bell** (a.k.a., Kevin Bell) converted the code for VBA use at [accessui.com](https://accessui.com/Products/VBATaskDialog)
- **Rob Cooper** and **Shane Groff** helped Kevin Bell along the way

> "If I have seen further it is by standing on the shoulders of giants."  
> \- Sir Isaac Newton

## Sample Code

The only code you really need to worry about is contained in a single, easy-to-work-with class module, `cTaskDialog`. 

The sample code below can be used to generate the task dialog that follows:

```vba
Dim TaskDialog As cTaskDialog
Set TaskDialog = New cTaskDialog

With TaskDialog
    .Init
    .Flags = TDF_USE_COMMAND_LINKS
    .MainInstruction = "Command Buttons"
    .Content = "Bet you can't do this with a MsgBox!"
    '.CommonButtons = TDCBF_CANCEL_BUTTON
    .IconMain = TD_SHIELD_WARNING_ICON
    .Title = "TaskDialog Samples"

    .AddCustomButton 201, "Press Me!"
    .AddCustomButton 202, "No... No... Press Me!!!" & vbLf & "You can also have sub text by adding a line feed."
    .AddCustomButton 203, "With a Command Link you don't have to have any buttons!"

    .ShowDialog
    Debug.Print "User pressed: "; .ResultMain
End With
```

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/01/image-13.png)

## Requirements

To run the code, you will need a reference to the **DAO library** (Tools > References > "Microsoft Office 16.0 Access database engine Object Library").

You will also need to import the following code modules into your project:

- `cTaskDialog` (class module)
- `basTaskDialogGlobal`
- `basGDIPlus_Lib`
- `basDialogWrapper` *(optional)*

All of these modules are in the sample database available for download on Kevin Bell's site, <https://accessui.com/Products/VBATaskDialog>

Kevin's database also has a ton of other custom dialog samples along with convenient buttons that jump you right to the code used to generate each sample.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/01/image-15.png)

The cost for all this goodness? **FREE!!!**  (*Just be sure to leave the copyright notices in place 😉*)

---

### External references

[AccessUI - VBA TaskDialogVBA Class Implementation of TaskDialog for Microsoft Access.![](https://accessui.com/favicon.png)AccessUI![](https://accessui.com/images/TaskDialog/tdCustomButtons.png)](https://accessui.com/Products/VBATaskDialog)

[\[VB6\] TaskDialogIndirect - Complete class implementation of Vista+ Task Dialogs-VBForumscTaskDialog 1.2 Say goodbye to unsightly, primitive messageboxes forever with the new enhanced TaskDialog. Updated released 21 March 2020 178039 Download Attachment: 175489VBForums - Visual Basic and VB .NET Discussions and More!![](https://www.vbforums.com/images/misc/logo.gif)](https://www.vbforums.com/showthread.php?777021)

[About Task Dialogs - Win32 appsA task dialog is a dialog box that can be used to display information and receive simple input from the user.Microsoft Docsjwmsft![](https://docs.microsoft.com/en-us/media/logos/logo-ms-social.png)](https://docs.microsoft.com/en-us/windows/win32/controls/task-dialogs-overview)