- database solutions and downloads for microsoft access

Microsoft Access Macros

Showing a Please Wait/Progress Macro

There maybe occasions where you will need to display a message to inform your user's that they must wait for an action or process to be completed.

You may want to display the text "Database Loading" whilst Access initializes a large database, or display the text "Please Wait" whilst Access runs a long query.

To display a status message follow the details below:

  1. Create an unbound form, named Please Wait using the following properties:
    • Caption: Please Wait
    • Scrollbars: Neither
    • Popup: Yes
    • Modal: Yes
    • Record Selectors: No
    • Navigation Buttons: No
    • Dividing Lines: No
  2. Add a label to the form. Set the label to the caption you would like to display, for example Please Wait or Database Loading. Format the label's text and size as required.
  3. Create the following macro:

    If you are using the form as the opening form, prior to your database loading then save the macro as AutoExec, if you are using this to attach to a long query then save the macro as mcr_Test.

    Macro Name Action
    mcr_Test Open Form

    mcr_Test Actions
    Open Form  
    Form Name Please Wait
    View Form
    Data Mode Read Only
    Window Mode Normal

    mcr_Test Actions
    Object Type Form
    Object Name Please Wait

    mcr_Test Actions
    Open Query  
    Query Name "Name of Your Query"
    View Datasheet

    mcr_Test Actions
    Object Type Form
    Object Name Please Wait
    Save No

    NOTE: The example detailed above is opening a query using the OpenQuery action, although this can be substituted with other details.
  4. To test this you can run the macro from the database window. This macro can then be attached to the On Click event of a command button on any of your forms. This will open up the Please Wait form, which will disappear once the query results are generated.

If you wish this form to be opened as your database is loading, you will name the macro as AutoExec as this is the first thing that runs on opening of the database.