Code Examples

Add New Records

acCmdDataEntry, acCmdRemoveFilterSort

This code goes behind a Command Button called cmdDataEntry. It changes a form from an edit form  into a data entry form and vice versa.

'***************** Code Start *******************
' Original code by Tery Wickenden

Private Sub cmdDataEntry_Click()

  Dim ctl As CommandButton

  Set ctl = Me.cmdDataEntry
  Select Case ctl.Caption
    Case "Add New Records"
      DoCmd.RunCommand acCmdDataEntry
      ctl.Caption = "Show All Records"
    Case "Show All Records"
      DoCmd.RunCommand acCmdRemoveFilterSort
      ctl.Caption = "Add New Records"
  End Select
  Set ctl = Nothing

End Sub

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

© 1998 - 2011 Terry Wickenden TKW Design Site developed maintained and hosted by TKW Design. This site is best viewed at 1024 x 768. Optimised for Firefox.