Chapter 19: Advanced Access Form Techniques
707
Closing the form
The dialog box form remains on the screen on top of the query results. The following line was
added to the Click event of the Run Query button to remove the form from the Access desktop:
DoCmd Close acForm, Me.Name
In some cases, however, you’ll want to continue to reference information in the dialog box after the
user is done with it. In these cases, you should hide the dialog box form, rather than close it. Use
the following statement at the bottom of the Click event to hide the dialog box form as the query
opens:
Me.Visible = False
As with any user-interface component, always completely test any dialog box. Because it “takes
over” the user’s desktop, you want to make sure the dialog box behaves as expected and doesn’t
impede or annoy the user in any way.
Summary
This chapter has assisted you in understanding Access forms. You now have a better grasp on the
workings of the Access event model. You now know how to programmatically manipulate the
many controls that constitute the building blocks out of which forms are constructed. You also
have a larger bag of tricks from which to draw when you’re building Access forms.
The advanced forms features in Microsoft Access boggle the mind. You probably won’t use all the
new form design tricks in your first Access 2010 application, but it’s nice to know what you can do
with this truly remarkable development platform.