K
KiwiMan
Hi
I am using access 2003.
I need to copy the contents of a control (text box, called ID) from a form so
I can paste the contents of the field in another application. I am trying to
do this so whenever I move to a new record, using the Record Navigation
Buttons, the ID field is copied to the clipboard.
I am using the following:
Me!ID.SetFocus
DoCmd.RunCommand acCmdCopy
This seems to work fine when I use the code in a button or in a (On Got Focus)
or (On Lost Focus) procedures.
The problem is that when I use it in the (On Current) event of a Form, it
will give me the following error (to me it is equivalent to the blue screen
of death):
Run-Time error '2046':
The Command or Action 'Copy' isn't available now
I have tried so many things and been looking around on the MS website and
other independant forums without much luck. My questions are:
1) Why the code doesn't work through the (On Current) event only
2) Is there a way to solve the problem
Thank you in advance
I am using access 2003.
I need to copy the contents of a control (text box, called ID) from a form so
I can paste the contents of the field in another application. I am trying to
do this so whenever I move to a new record, using the Record Navigation
Buttons, the ID field is copied to the clipboard.
I am using the following:
Me!ID.SetFocus
DoCmd.RunCommand acCmdCopy
This seems to work fine when I use the code in a button or in a (On Got Focus)
or (On Lost Focus) procedures.
The problem is that when I use it in the (On Current) event of a Form, it
will give me the following error (to me it is equivalent to the blue screen
of death):
Run-Time error '2046':
The Command or Action 'Copy' isn't available now
I have tried so many things and been looking around on the MS website and
other independant forums without much luck. My questions are:
1) Why the code doesn't work through the (On Current) event only
2) Is there a way to solve the problem
Thank you in advance