A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"Copy" isn't available now Error



 
 
Thread Tools Display Modes
  #1  
Old January 2nd, 2010, 08:23 PM posted to microsoft.public.access.forms
Pamela
external usenet poster
 
Posts: 193
Default "Copy" isn't available now Error

I have a command button on my Main Form that is supposed to, on the OnClick
Event, set focus to a control on a subform and copy its contents and then
close the entire form but I am getting an error that "The command or action
"Copy" isn't available now." Any ideas about how to work around this?? The
OnGotFocus event of the text box to be copied runs it's own code that
concatenates text from all over the form. This box does have a tab stop but
I have it coded so that focus doesn't go to it directly for the user - only
for the purpose of copying here. Here is my code attached to the command
button trying to run the copy procedu
On Error GoTo Err_cmdExit_Click
Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage .Form!sfrmEstimate.Form!Text6.SetFocus
DoCmd.RunCommand acCmdCopy
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
Thanks so much for any help!
Pamela
  #2  
Old January 2nd, 2010, 10:24 PM posted to microsoft.public.access.forms
Tom Wickerath
external usenet poster
 
Posts: 3,914
Default "Copy" isn't available now Error

Hi Pamela,

If I am reading your code correctly (?), you are attempting to copy the
value from a text box named "Text6", that is in a subform four levels deep to
your main form, ie.:

Main Form
--- Inspections subform
---- Locations subform
---- Damage subform
---- Estimate subform : Text6

Have you tried something like this?

On Error GoTo Err_cmdExit_Click
Dim strText As String

strText =
Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage .Form!sfrmEstimate.Form!Text6 '---All on one line

You might need to use the Nz function as well (I'm not really sure without
taking the time to set up a test):

strText =
Nz(Me!sfrmInspection.Form!sfrmLocation.Form!frmDam age.Form!sfrmEstimate.Form!Text6, "") '---All on one line

This all looks pretty messy. Good Luck!


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

"Pamela" wrote:

I have a command button on my Main Form that is supposed to, on the OnClick
Event, set focus to a control on a subform and copy its contents and then
close the entire form but I am getting an error that "The command or action
"Copy" isn't available now." Any ideas about how to work around this?? The
OnGotFocus event of the text box to be copied runs it's own code that
concatenates text from all over the form. This box does have a tab stop but
I have it coded so that focus doesn't go to it directly for the user - only
for the purpose of copying here. Here is my code attached to the command
button trying to run the copy procedu
On Error GoTo Err_cmdExit_Click
Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage .Form!sfrmEstimate.Form!Text6.SetFocus
DoCmd.RunCommand acCmdCopy
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
Thanks so much for any help!
Pamela

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.