Duplicating a record in a form, errors out if attempted after a save or after moving from a previous record

Posted on 2007-10-04
Last Modified: 2012-06-27
MS Access database - built using '97, converted to 2000 file format, working in 2003

A record is created and saved.  At a later date/time the user goes in and updates the record.  They click the "Update Record" button.  This set the field for active to 0, creates a new record, then copies the current record into a new record, sets some data, then sets the record in edit mode.

If the form is opened and the update record button is clicked, all goes according to plan.  If the form is opened, and the user goes to a different record, it errors out.  If the record is saved and then an update record is attempted, it error out.
The error received:
The command or action 'PasteAppend" isn't available now

The updated record code:
Private Sub cmdUpdateRecord_Click()
On Error GoTo Err_cmdUpdateRecord_Click

    Me.Active = False

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
    Me.Species_Qty = Me.Total_Species_Qty
    Me.Mod_Date = Now()
    Me.Mod_Species_Qty = 0
    Me.Active = True
    Exit Sub

    MsgBox Err.description
    Resume Exit_cmdUpdateRecord_Click
End Sub

Question by:ceegomez
    1 Comment
    LVL 11

    Accepted Solution

    Just a quick thought - if I was copying a record, I'd prob just run a SELECT INSERT sql query on the table to copy the last record. Then you just need to go to the latest record in the form.

    Of course this might not apply but hope it helps :o)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now