Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Amersfoort, Utrecht, Netherlands
    Thanked 0 Times in 0 Posts

    copy record by code (97nl)

    Hello all,

    Is it possible, when showing a record from the database by a form, to have a button thas does the following:
    - Copy the current shown record (without the ID field) to a new record
    - Set the form to the new record, so it could be changed right away

    Thanks in advance for your comments...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: copy record by code (97nl)

    If you create the command button with Control Wizards "on", one of the options suggested by the Command Button Wizard is a Duplicate Record button. You can use this, and adapt the code, or create a similar button directly. The On Click code for such a button looks like this:

    Private Sub cmdDuplicateRecord_Click()
    On Error GoTo ErrHandler

    RunCommand acCmdSelectRecord
    RunCommand acCmdCopy
    RunCommand acCmdPasteAppend
    RunCommand acCmdRecordsGoToLast

    ' If necessary, modify fields here
    Me.SomeField = Null

    Exit Sub

    MsgBox Err.Description, vbExclamation
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts