Results 1 to 2 of 2
  1. #1
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109

    copy and paste record

    HTML Code:
    I have a button on the form which I want to copy and paste the selected row. However it pastes only the fields which are listed on the form. How do I copy and paste all  columns in the table for the selected row?
    Code:
    Private Sub btnDuplicateRecord_Click()
    On Error GoTo btnDuplicateRecord_Click_Err
        On Error Resume Next
        DoCmd.RunCommand acCmdSelectRecord
       
            DoCmd.RunCommand acCmdCopy
            DoCmd.RunCommand acCmdRecordsGoToNew
      
            DoCmd.RunCommand acCmdSelectRecord
       
            DoCmd.RunCommand acCmdPaste
      
    btnDuplicateRecord_Click_Exit:
        Exit Sub
    btnDuplicateRecord_Click_Err:
        MsgBox Error$
        Resume btnDuplicateRecord_Click_Exit
    End Sub


  2. #2
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 10 Access 2016
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    I think what you want is similar to this. You are pretty close though
    Code:
    Public Sub Duplication()
     DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
     DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70 
     DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
     DoCmd.Save
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Copy and Paste a Record in a subform
    By Joakim N in forum Programming
    Replies: 3
    Last Post: 10-30-2016, 12:41 PM
  2. Replies: 3
    Last Post: 03-09-2013, 10:39 AM
  3. Copy-paste every other record into bew table
    By BorisGomel in forum Access
    Replies: 5
    Last Post: 02-09-2012, 03:52 PM
  4. Replies: 2
    Last Post: 06-06-2011, 04:18 PM
  5. Copy/paste to new record.
    By xbox1513 in forum Forms
    Replies: 1
    Last Post: 02-23-2011, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums