Run-time error '2046' - The command or action 'Copy' isn't available now.

M

Mick Ruthven

I have an Access 2002 application that's been running for years. One feature
is a button on a form that copies the string contents of a control to the
clipboard. This morning it stopped working and gives this instead:

Run-time error '2046' - The command or action 'Copy' isn't available now.

Here is the code. It stopped on the "acCmdCopy" line. CtrlName is a variable
that contains the name of the control (I checked and it does contain it),
and the control contains the string to be copied (I checked that too)..

DoCmd.GoToControl CtrlName
DoCmd.RunCommand acCmdCopy

Any ideas? This function has worked for years, including just a few days
ago, and I've not changed anything regarding Access other than creating a
new Access Project using SQL Server, but that should have nothing to do with
this standalone Access app. It's on a Win XP SP1 system.

Thanks,

Mick Ruthven
 
O

Ooh Rah via AccessMonster.com

Mick,

I have had this a few times and what it was for me was a reference missing.
Has this computer been recently updated? New installation? Had new software
installed ?

I hope this helps
 
M

Mick Ruthven

Hmm, the computer itself hasn't had any changes. There may have been a
Windows update. I don't think I installed any new software in the time after
the function last worked.

How would I go about determining was reference was missing?
 
M

Mick Ruthven

I created the problem myself. I had changed the "Behavior entering field"
keyboard option in Access from "Select entire field" to "Go to start of
field". The DoCmd.RunCommand acCmdCopy depends on the text in the control
being selected, and the prior DoCmd.GoToControl CtrlName was going to the
control but not selecting the text. I set that option back to "Select
entire field" and it works fine. I do need to find a more robust method that
doesn't depend on that option being set a certain way. I found a page that
says it does just that. http://www.mvps.org/access/api/api0049.htm
 
O

Ooh Rah via AccessMonster.com

I am glad to hear you resolved your issue and sorry my info was of no help.

But to answer your question about finding missing references, go into your
source code and at the top to tools then references. Any missing files will
have missing preceeding them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top