none
DoCmd.RunCommand acCmdPaste RRS feed

  • Question

  • Why can't I just use the DoCmd.RunCommand acCmdPaste to paste the contents of the clipboard into an Access table in VBA. Excel can do it. tried a bunch of code to split() the string into separate fields values but the split function does not parse the string correctly. seems like a simple thing any help would be appreciated.
    Thursday, December 14, 2017 12:12 PM

All replies

  • I have the below code attached to a button "Next" on a form.   In Access you PasteAppend into tables.

    Private Sub cmdNext_Click()
    On Error Resume Next
    Application.Echo False
    DoCmd.SetWarnings False
    DoCmd.RunSQL "DELETE * FROM tblSelectData"
    
    DoCmd.OpenTable "tblSelectData"
    DoCmd.GoToRecord , , acLast
    DoCmd.RunCommand acCmdPasteAppend
    DoCmd.Close acTable, "tblSelectData"
    
    DoCmd.SetWarnings True
    Application.Echo True
    
    End Sub
    


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.

    Thursday, December 14, 2017 4:15 PM
  • No one in this forum can tell you because you didn't say what happened when you tried and you didn't post the VBA code you tried. So, post the code you are using and tell us what error messages you are getting (if any). I do know that the Paste function in ACCESS works differently than EXCEL when you use it to Copy and Paste data into a table. Also, where is the data coming from? And are you Appending new data into a table field or are you Udating existing field data? Please give us more information and maybe someone will be able to help you.

    Thursday, December 14, 2017 4:32 PM