Microsoft Office Tutorials and References
In Depth Information
Opening Forms with DoCmd
As with any VBA keyword, as soon as you type DoCmd in the Code window,
a menu of acceptable words that you can type next appears, as shown in
Figure 4-2. Use the scroll bar on the right side of the list to see all your
you type in
You can also use the VBA help system to find more information on the
DoCmd object and its methods. Type DoCmd in the code window and then
press F1 to get help with that object.
Finding umpteen ways to open a form
Although many methods are available in the DoCmd object, the OpenForm
method provides a good example. The syntax of the OpenForm method is
DoCmd.OpenForm FormName, [View], [FilterName], [WhereCondition], [DataMode],
In this syntax,
✦ FormName represents the name of the form that you want to open.
✦ View represents the view in which you want to open the form, using the
• acNormal: Form view. Use this view if you omit the View argument
in the statement.
• acDesign: Design view.
• acLayout: Layout view.
• acFormDS: Datasheet view.
• acFormPivotChart: PivotChart view.
• acFormPivotTable: PivotTable view.
• acPreview: Print Preview.