rathinagiri wrote:
3. A variable for the total pages like _totalpages. It will help to print like "Page Number 5 of 10"

This could be a problem, since the table to report could be filtered and/or indexed, so, the only way to know the total report pages prior to generate the report is use the COUNT command to know record count and then calculate the pages. The problem is that this process could be very slow on big tables (remember that I supposing filtered/indexed tables).