Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy a Report Control using code

Status
Not open for further replies.

storm75m

Programmer
Apr 18, 2001
81
0
0
US
This should be pretty simple...

All I need to do is copy a text box control from one report to another using code. I tried this:

DoCmd.OpenReport "SampleBillMaster", acViewDesign
Reports!SampleBillMaster!Text328.SetFocus
DoCmd.RunCommand acCmdCopy

But it gives me an error saying that the SetFocus method cannot be used in the current view. Any help would be much appreciated, a code sample would be even better! Thanx in advance...
 
The setfocus command is for run time.

That is why your getting the error. What are you trying to do with the copied object?
 
Do you want to copy a CONTROL, or the VALUE in it?

Can't see any reason to copy the CONTROL. And even if it DID work, when you went to PASTE the control, it probably wouldn't be POSITIONED where you wanted it, so you'd have to move it by hand anyway.

Can you clear things up?

Jim

How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Well I need to paste the control onto about 80 different reports, and I was just going to use a loop to take care of if. I can easily use the Move method of the object (or set the Top and Left properties of the text box to put it where I want it.) If I can't copy and paste the text box from one report to another then is there a way to create a new text box on a report in code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top