Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Location
    Alabama
    Posts
    37

    Unanswered: Paste Errors ????? I am Stumped.

    Paste Errors ????? I am Stumped.

    --------------------------------------------------------------------------------

    I am stumped.

    I have added a button to my form with the following code. When I run the code I get the "Paste Error" message.

    Private Sub Command1666_Click()
    On Error Resume Next
    PlaySound "H:\Generald\media\carbo.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC


    On Error GoTo Err_Command1666_Click


    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

    Exit_Command1666_Click:
    Exit Sub

    Err_Command1666_Click:
    MsgBox Err.Description
    Resume Exit_Command1666_Click


    End Sub



    Access 2000
    Records that " " was unable to paste have been inserted into a new table called paste errors.

    Thanks

    Carbo

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    From what I gather from your code you are:

    - Working with a Form...
    - You Select the Current Record...
    - Copy The Current Record...
    - The Paste Append this record as a new Record.

    Correct?

    Your code should work unless perhaps there is something else accessing the Form as well or the original record wasn't saved yet because something was null that shouldn't be or a wrong data type was encountered.

    I personally would do it this way:

    Code:
    Private Sub Command1666_Click()
       On Error Resume Next
       PlaySound "H:\Generald\media\carbo.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC
       On Error GoTo Err_Command1666_Click
     
       DoCmd.RunCommand acCmdSelectRecord
       DoCmd.RunCommand acCmdCopy
       DoCmd.RunCommand acCmdPasteAppend
    
    Exit_Command1666_Click:
       Exit Sub
    
    Err_Command1666_Click:
       MsgBox Err.Description
       Resume Exit_Command1666_Click
    End Sub
    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

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