Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 7.0: REPORT: Are "FOR" and "RANGE" mutually exclusive?

Status
Not open for further replies.

Kimed

Programmer
May 25, 2005
104
LT
Hi,

I've made a form to print reports that allows selecting a subset of data to be printed. In the end, it issues a command like

REPORT FORM &c_report &c_filter &c_printer &c_range noconsole

where all character variables are assembled according to options selected in the form. When I set c_filter to "for [some_condition]", it works okay. When I set c_range to "range [from],[to]", it also prints only pages I ask for. But when I'm trying to filter a subset of data *and* print only selected pages of it, it only recognizes "FOR" clause but not "RANGE". Is it supposed to be this way?

Thanks
 
This is sort of an apples/oranges question. From the help file:
RANGE nStartPage [, nEndPage]
Except in preview, specifies a range of pages to print. nStartPage specifies the first page printed; nEndPage specifies the last page printed. If nEndPage is omitted, the last page printed defaults to 65,534.
FOR lExpression1
Prints data only in those records for which lExpression1 evaluates to true (.T.). Including FOR makes it possible for you to filter out the records you don't want to print.
So if your report uses 20 pages worth of data from the table, but you ask for a range of pages from 10-12, you get a subset of the subset.
Make sense?

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Is it supposed to be this way?

I don't know but it looks like that's what you're seeing.

Why not try the alternative approach and use SQL to preselect the records you want:
Code:
Select field1, field2, field3 from myTable where (c_filter) Into cursor csrTmp
Report Form &c_report &c_printer &c_range noconsole 
Use in csrTemp

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top