DoCmd.OpenForm

Open a form.

Syntax
      DoCmd.OpenForm(FormName, View, FilterName, WhereCondition,
                     DataMode, WindowMode, OpenArgs)


Key
   FormName       The name of the form to open.

   View           An AcFormView constant that specifies the view
                  in which the form will open. Default=acNormal

   FilterName     The name of a query saved in the current database.

   WhereCondition An SQL WHERE clause (without the word WHERE.)

   DataMode       An AcFormOpenDataMode constant that specifies the
                  data entry mode for the form.
                  applies only to forms opened in Form or Datasheet view.

   WindowMode     An AcWindowMode constant that specifies the
                  window mode in which the form opens.
                  default = acWindowNormal.

   OpenArgs       A string expression that is used to set the form’s
                  OpenArgs property. This may then be used by code
                  in a form module.

Use OpenForm to open a form in Form view, form Design view, Print Preview, or Datasheet view.

Examples

'Open frmAppointments and display records for the current patient:
DoCmd.OpenForm "frmAppointments", , , "PatientID=" & Me!txtPatientID

'Open frmTravel and display all the records
DoCmd.OpenForm "frmTravel"

“I get all the news I need from the weather report” ~ Paul Simon

Related:

OpenReport - Open a report
SetParameter - Set a parameter before opening a Form or Report.


© Copyright SS64.com 1999-2013
Some rights reserved