I tried many options but this one which I found on a forum worked really fine.
1. Put the subreport in its own section (add more sections in the section expert).
2. Right-click the subreport and select Format Subreport.
3. On the subreport tab check Suppress Blank Subreport.
4. Then go back to the main report and for the section holding the subreport, right-click the grey area to the left and select Section Expert.
5. Set the option Suppress Blank Section.