The normal method is having
Cancel = True
In the no data event of the report. That also requires error trapping in the code that opens the report. I'm not sure how to do either with macros though. If you want to stay with the macro, you could add a condition and use DCount() to test the report's record source.