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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 6 Selective printing on label

Status
Not open for further replies.

eric43

Programmer
Apr 29, 2005
94
AU
Is it possible to add a command to only print a (record on a) label when a certain value is true ( without adding an expression to each field)

ie the table has a 'selected' logical field to enable only some from thousands of records to be printed each time.

Regards

ERIC
 
SELECT * FROM MyTable WHERE MyTable.Selected INTO CURSOR crsRep
REPORT FORM MyReport PREVIEW IN SCREEN TO PRINTER PROMPT NOCONSOLE

This assumes that you have not prefaced your field expressions in the report with the name of MyTable, such as "MyTable.MyField". But, instead have used just "MyField". If this is not the way that you have done it then you would need to make the appropriate changes in the report or label.

However, it might be worth noting that in VFP 9 you can select multiple fields on your report and set the Print When for all of them at the same time by going into the properties for them once you have them all selected. This would make adding a print when to each field quite a bit less tedious. However, in doing something like this you will have lessened the scalability of the report/label, whereas the previous example that uses a dynamic cursor allows you to easily provide your users with different filtered sets of records whether they are based on the 'selected' field or some other criteria without having to modify the report/label at all. Just pop in a different where clause or even change the sorting by adding an order by clause.

I almost always use cursors to drive reports/labels in the applications I work with for the very reasons I've outlined here.

boyd.gif

SweetPotato Software Website
My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top