DoCmd.BrowseTo

Navigate between objects. (Access 2010)

Syntax
      DoCmd.BrowseTo(ObjectType, ObjectName, PathtoSubformControl,
                           WhereCondition, Page, DataMode)

Key
   ObjectType   The object type to browse:
                acBrowseToForm (2) or acBrowseToReport (3)

   ObjectName   The object that loads inside the subform control referenced
                by the PathtoSubformControl argument.

   PathtoSubformControl
                If specified, the path from the main form of the
                application to the target subform control that loads the
                object specified by ObjectName.

   WhereCondition
                If specified, replaces the Where condition of the
                object record source.

   Page         If specified, sets the page of the continuous form that will be made the current page. This argument is Web only.

   DataMode     If specified, the data entry mode of the form AcFormOpenDataMode.

BrowseTo can be used to navigate between objects in place e.g. navigate from form1 to form2 without opening a new window. You can also change the source object of a subform control by specifying PathToSubFormControl.

The PathToSubFormControl argument must include the parent form/control names as in the following example:

frmMainForm.SubFormCtrl1>Form2.SubFormCtrl2>Form3.SubFormCtrl3

Example

Opens frmSales in Add-Data mode in the "sfrNavigation" subform control on the form "frmMain".

DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
ObjectName:="frmSales", _
PathToSubformControl:="frmMain.sfrNavigation", _
WhereCondition:="", _
Page:="", _
DataMode:=acFormAdd

“A careful driver is one who honks his horn when he goes through a red light” ~ Henry Morgan

Related:

SetParameter - Set a parameter before opening a Form or Report.
Syntax - Form references
.NavigateTo - Display a database object in the Navigation Pane.


© Copyright SS64.com 1999-2014
Some rights reserved