6.1. Form Navigation and Flow

You can control the order and manner in which forms can be opened within your Access applications in various ways. For example, you can design switchboard forms that allow the user to select which form to open. Another option is to open a main form and allow a user to open separate forms from the main form. The style of navigation you choose depends on the type of system and the manner in which users will interact with the various forms.

During the design phase, you should consider the flow of forms and how users will navigate from one form to the next. It is very simple to control how forms are displayed. The following is an example that illustrates how to open, hide, minimize, and close forms.

'open a form
DoCmd.OpenForm "FormName"
'close a form

DoCmd.Close acForm, "FormName"

'minimize the current form
DoCmd.Minimize

'hide a form
FormName.Visible = False

'make the form visible again
FormName.Visible = True

A well-designed application allows a user to interact with the application without having to use Access to open the form manually from the database window. An easy way to have a form open automatically is to use the AutoExec macro to specify which form should open automatically when the application opens.

Try It Out: Building a Switchboard Form

In this example, you will build a simple switchboard form that opens automatically when the application opens. The switchboard form enables the user to open multiple forms from a menu of choices.

  1. Create ...

Get Beginning Access™ 2007 VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.