Hiding Subreports in Mainreport via Form

J

jvdb

Hi there,

i have a form, where i want to select wich subreports are .visible= false or
true on a mainreport.

but i can't get it working properly, because i'm somehow not able to change
the settings in the mainreport via the form:

if ckbsubreport5 = -1 then
forms!mainireport.subreport5.visible = false
elseif ckbsubreport5 = 0 then
forms!mainireport.subreport5.visible = true
end if

can somebody tell me what im doing wrong
 
D

Duane Hookom

If you are reporting a report then you code should state "Reports!" not
"Forms!".

I would add code to the On Format event of the section in the report that
contains the subreport.

Me.subreport5.Visible = (Forms!frmYourForm!ckbsubreport5 = 0)

I think this will hide the subreport if the box is checked. Substitute in
your form name in the code.
 
J

jvdb

Thanks for your help, it works now, i also had to open the report first
before i could change its settings
 

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

Top