M.2. Daisy Chain Your Forms

When your user navigates from one form to another, one of your jobs as an application developer is to keep things simple. When users have the ability to click between multiple open forms, they can lose track of their current form, or perform actions that you fail to handle properly. A safer approach is to carefully control which forms are visible at any one time.

Controlling the visibility and flow of one form to another is often called "daisy chaining." There are a few different types of daisy chaining. They involve two main choices: whether to hide the calling form, and whether to open the called form in Dialog mode. For this example, say the calling form is Form A and the called form is Form B.

If Form A needs to be requeried after Form B is closed, then open Form B in Dialog mode to have Form A's code wait until the user is finished with Form B. This often occurs when Form A is an index form showing multiple records, and Form B is a detail form where the user can create, change, or even delete one of the records.

If Form A provides some contextual information that would be handy for the user to see while Form B is open (such as which record he's currently working with), then you can leave Form A visible while Form B is open. To prevent the user from clicking between the two and possibly obscuring Form B, use your old friend Dialog mode to prevent him from clicking on Form A.

If Form A does not need to be visible while Form B is open or requeried ...

Get Access™ 2007 VBA Programmer's Reference 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.