Hello,
I'm getting very frustrated trying to solve what I thought was going to be a simple problem. It may be that I've wrongly assumed the sub reports work the same way as subforms - please put me right if that is incorrect!
I was trying to make fields visible/not visible depending on the value to two unbound fields on the sub report added together using VBA to no avail. When trying to work out why it wasn't working, it turned out that getting rid of the if function made no difference; the visible parts weren't working themselves. I tried different ways of referring to the fields, but nothing made any difference. I tried it as 'Me.[SubReportName].Report![ControlName].Visible', but also as 'Reports![MainReportName]![SubReportName].Report![ControlName].Visible' but neither worked. Can anyone point me in the right direction? Below is an example of my code that doesn't work:
EDIT: For extra information, I've put this code in the 'On Load' event, but also been looking into the 'On Format' event, but to be honest I don't really understand it! Tried it in the main report section where the subreport is, but nothing happened again.Code:Reports!rptTomorrowDeliveries!rptTomorrowsDeliveriesSub2.Report!txtNumDel.Visible = False Reports!rptTomorrowDeliveries!rptTomorrowsDeliveriesSub2.Report!TxtNumCol.Visible = False Reports!rptTomorrowDeliveries!rptTomorrowsDeliveriesSub2.Report!LblPrev.Visible = False Reports!rptTomorrowDeliveries!rptTomorrowsDeliveriesSub2.Report!Referral.Visible = True Reports!rptTomorrowDeliveries!rptTomorrowsDeliveriesSub2.Report!ReferralContact.Visible = True Reports!rptTomorrowDeliveries!rptTomorrowsDeliveriesSub2.Report!ReferralTelNo.Visible = True Reports!rptTomorrowDeliveries!rptTomorrowsDeliveriesSub2.Report!ReferralInfo.Visible = True