Thanks. Your script works nicely on the first page of my report. I use a title header on the first page. Once page one, however, I get the correct page number but gPages comes up blank.
I added a dialogue box to the script for testing purposes and it reports the correct value for gPages.
In browse mode, gPages also shows the correct value. In preview mode, though, it comes up blank -- except in the title header on page 1.