total number of pages on a Xojo report

This is a Report Question, not sure where it should go.
I am trying to print on the footer of a report “Page X of Y” where the X is the current page and the Y is the total number of pages.
I can easily get the current page but I have not been able to get the total number of pages.

when I try to use the “before print” event on a label and capture the rpt.Document.PageCount that comes as a null value and gives me an error.

Open to suggestions.

I remember this is a Bug since they intruduced the Report Editor in 2009.