>I have this code, but it doesn´t work.
>PLease checkout...
>
>public totalpaginas
>use ttidist
>set order to tag fecha
>inicio={^1999/11/01}
>final={^1999/11/25}
>report form repopdis for betw(fecha_opr,inicio,final) to file prueba.tmp noconsole
>totalpaginas = _pageno
>report form repopdis for betw(fecha_opr,inicio,final) preview
Your report would need to reference the memory variable totalpaginas for the value for the last page.
A more serious problem comes up using REPORT with a filter condition and preview - if you preview and then print, the filter gets squirrelly and essentially gets blown away. if your report doesn't use its own data environment, try the following:
SELECT 0
use ttidist ALIAS sourcetbl
inicio={^1999/11/01}
final={^1999/11/25}
SELECT * FROM sourcetbl INTO CURSOR ttidist ;
WHERE fecha BETWEEN inicio AND final ;
ORDER BY fecha
USE IN sourcetbl
report form repopdis to file prueba.tmp noconsole
totalpaginas = _pageno
report form repopdis preview
USE IN ttidist