Share via

Runtime Error 2046 - The command or action Paste isn't available now

Anonymous
2011-03-18T04:04:29+00:00

I have seen similar errors and workarounds for opening forms and for copy, but not for 'Paste'.  Note, this database and this code has worked for years, and sudenly today, without any changed to code, I get this error.  Note also I'm a novice and barely able to program my way out of a paper bag, so be gentle!

Here is the code from the form - the intent is simply to copy a record, duplicate it, and increment a reference number:

    DoCmd.RunCommand acCmdSelectRecord

    DoCmd.RunCommand acCmdCopy

    DoCmd.RunCommand acCmdRecordsGoToNew

    DoCmd.RunCommand acCmdSelectRecord

    DoCmd.RunCommand acCmdPaste

    [Ref Number] = [Ref Number] + 1

Some other points to ponder:

This worked fine for years - I believe this started after some Vista updates were automatically loaded.  I have made no changes to my forms or visual basic code in a long time (and frankly, I'm very rusty at it).

I restarted my computer and restarted my Access program. It ran fine once (added the record, did what it was supposed to), but then it stopped again - so it appears somewhat intermitent. I didn't try this a second time - not sure if that would prove anything...

I've got 27,000 photos of my life experience in this database - this code is what lets me add a picture and copy most of fields from the last record I added.  Any help is appreciated!  But please speak in bonehead - that is as good as I can do!  Thanks!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2011-03-18T05:41:31+00:00

    Thanks for the reply!  Yes, I have a current backup, and I compacted it earlier this evening (it was 16MB, now it is 8MB, but it still had the problem).  When I am in the form, I can manually paste append a new record, but that doesn't increment the reference number or perform some of the categorization that I had programed in. 

    That said, I did keep researching and found some similar code that has fewer steps.  I replaced my code with this, and initially it did not work - but then it started to work with the new code.  The new code is:

    DoCmd.RunCommand acCmdSelectRecord

    DoCmd.RunCommand acCmdCopy

    DoCmd.RunCommand acCmdPasteAppend

    followed by my code that increments the reference number.

    So for the moment, it appears to be working with this new code - but I can't see why the changes I made would make that much difference (especially since the whole thing worked fine when I was in this database earlier this week).

    I'm not sure what an Append Querry is - if that is a better way to do the same thing, where can I find out more about that?

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2011-03-18T05:26:01+00:00

    Well, if I were going to copy a record (or a set of records) I'd be inclined to use an Append Query rather than a bunch of RunCommands.

    That said... do you have a current backup!? You might be needing it. :-{( How big is the database file? Have you Compacted it? If you open the table can you manually type in a new record?

    More info please...

    Was this answer helpful?

    0 comments No comments