he command or action PasteAppend isn't available now

EddiRae

Registered User.
Local time
Today, 07:57
Joined
Aug 4, 2007
Messages
53
Hello,
I am trying to copy a record in a form using VBA code. I checked online and I am not finding anything that works. This is the last set of code that I found, but I am getting the error above when it tries to run the last statement of PasteAppend.

Here is the code:
Code:
    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdPasteAppend

Any help would be very much appreciated.

Eddi Rae
 
The inability to update a recordset implies either that the recordset is locked (but I would not have expected that particular message) or that the recordset is not updateable (again, I would have expected a different message). The most likely thing I might consider is that the form's "EditsAllowed" property is set to NO (or one of the other updating options is NO). Look on the form property sheet to find the "xxx Allowed" properties and verify that they are set to YES. I regret that I don't recall whether that appears on the Format or Data properties - but I know it isn't on the EVENT properties and don't think it is on OTHER.
 
Maybe try as an append query, below is an example.

Code:
stsql = "INSERT INTO theDestinationTable ( Field1, Field2, Field3, ImportDate ) " & _
        "SELECT [NewValue] AS Expr1, theSourceTable.Field2, theSourceTable.Field3, theSourceTable.ImportDate " & _
        "FROM theSourceTable "
        "WHERE theSourceTable.ProductCode= '" & Forms!FormName.TextboxName & "'"
CurrentDb.Execute stsql
 
The "Allow Edits" is "YES".
I even tried this command and I got the same error
"DoCmd.RunCommand acCmdUndo"
 
acCmdUndo failures don't surprise me. It is common to get an error for Undo if you haven't done anything. (Nothing done = nothing to undo.)

The "Isn't available now" message often means something is locked or is in some other transitory state where, if you could terminate that state, the requested action would work OK.

By any chance is the recordset a JOIN? If so, what are the characteristics?
 
Doc Man, the query for the record is linked to the prior form. Maybe that is it.

I did use the code that sxschech posted. This works to where it at least creates a copy and then I go back to the prior form and refresh it so that the new record is visible.

Thanks for all of your help with this.
I am thinking that we can close this!!
Eddi Rae
 

Users who are viewing this thread

Back
Top Bottom