delete a control

mikela

Registered User.
Local time
Today, 06:43
Joined
Nov 23, 2007
Messages
70
hello all!

How can i delete all the controls from a report by code?? From a form....

should it be something like:

for each ctr in reports![ReportName]
'delete control, i don't know the sentence yet....

next
 
Actually, the best way to do it would probably be to do something like this...
Code:
Dim Rpt as Report
  DoCmd.OpenReport "ReportNameHere"
    rpt = screen.activereport
      dim c as control

for each c in rpt
  rpt.deletecontrol "ReportName?", c
next
I wonder...??
 
You can't do that without first setting the report in design view. You can set controls visible property to false so that they don't show, but you can't delete them without being in design view.
 
Hey!

I've tried the following:

DoCmd.OpenReport "myreport", acViewDesign
Set rpt = Reports![myreport]

Dim c As Control
For Each c In rpt
rpt.DeleteReportControl rpt.name, c.name
Next


and it won't work... the following error appears:

Run-time error: 2465
application-defined or object defined error.

Any idea why it happens??
 

Users who are viewing this thread

Back
Top Bottom