Code Examples For RunCommand Constants

Select All Records

acCmdSelectAllRecords

The following code selects all the records on a subform. Note that this works even if the subform is in form rather than datasheet view. In this example, I've assumed that the subform control is called subTestForm.

'***************** Code Start *******************
' Code by Terry Wickenden

Private Sub cmdSelectAll_Click()

  Me.subTestForm.SetFocus
  DoCmd.RunCommand acCmdSelectAllRecords

End Sub

'****************** Code End ********************