Close an Access form after a set amount of time

You can set up a form to automatically close itself after a specified time duration, which is great when you want to create a splash screen for an application. To do so, you first need to set your form's Timer Interval property. Display the form's property sheet in Design view, and enter a value in the Timer Interval text box.

This property accepts a millisecond value, so to create an interval that's 3 seconds long you enter 3000.

After setting your desired value, click in the On Timer text box and then click the Build button (which looks like an ellipse).

This will open the Choose Builder dialog box. In this box, select either Macro Builder or Code Builder and then click OK.

If you created a macro, name the macro, and click OK. Once you are inside the design view window of the new macro, select or type Close in the first row's Action combo box. Leave the action arguments unchanged (Object Type and Object Name should be blank) so the macro will close the default form. Save and close the macro.

If you chose Code Builder, simply enter the statement DoCmd.Close , "" at the insertion point and close the module.

You should now be back in your form's design window. At this point, you can save and close your form. When you open the form, it will automatically close after the length of time specified in the Timer Interval property.

This tip was contributed by John J. Frost.


Created Date: 12/07/2001  Last Reviewed: 12/07/2001  Rev. Date:

This site was last updated 06/11/06