Hide a subreport based on the result from a checkbox in the main form

I have a report with several subreports that show up on the report based on if they have data in a specific table or not.  I need to be able to hide one of these subreports in the main report if I have a check box selected or not selected in the main form.  Can this be done by VBA code in the report?  I am not sure how for it to check the main form.  
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

in the Current event of the checkbox named chkBox:

Private Sub chkBox_Current()
  If Me!chkBox Then
    Me.Form!sfmName.Visible = False
    Me.Form!sfmName.Visible = True
  End If
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thirdrockitAuthor Commented:
I am not hiding a subform, I need to hide a subreport that is within a big report that has a lot of resume data in it.  I have a resume form that has several checkboxs so that my resume data can be selectable for what I want printed.  The data, once selected on the form, is then sent to a table.  The report, with the multiple subreports, pulls the info from the table.  Everything works great except now I have some data going to the table that will automatically cause the subreport to show.  I cannot stop the data from making it to the table so I need to just hide the subreport instead.
Create a public variable:
public glbHideSub as boolean

In the code prior to opening the report -
If {your condition = true) then
    glbHideSub = true
end if

In the report ON OPEN EVENT
me.YourSubReport.visible = not glbHideSub

don't forget to 'clear' the variable on closing the report:
glbHideSub = false

Scott C
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

OK in my code where you see Form, replace it (it it there two time) with Report
thirdrockitAuthor Commented:
Thanks for you help !!! I figured out how to do it so that when the box is checked it changes the data that the report is pulling from.   Unless the box is checked the data will not be in the table, and the sub report will not show because there is no data. I am awarding you all the points anyways because I may still be able to use your examples.
Thanks, glad to help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.