Code Examples

Copy To New Record

acCmdCopy, acCmdPasteAppend, acCmdSelectRecord

This example copies the existing record on a form and creates a new record with exactly the same information. If the underlying table has an Autonumber then this field takes the next available number. To use the code, create a button on the form called cmdInsert and paste the code into the On Click event.

'***************** Code Start *******************
' This code was originally written by Terry Wickenden.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.

Private Sub cmdInsert_Click()

   DoCmd.RunCommand acCmdSelectRecord
   DoCmd.RunCommand acCmdCopy
   DoCmd.RunCommand acCmdPasteAppend

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.