Visual Foxpro

Microsoft Visual FoxPro is a powerful object-oriented environment for database construction and application development. The Microsoft Visual FoxPro ODBC Driver enables applications to open, query, and update data in Visual FoxPro and earlier versions of FoxPro through the Open Database Connectivity (ODBC) interface. In this article. Microsoft Visual FoxPro is a powerful object-oriented environment for database construction and application development. The Microsoft Visual FoxPro ODBC Driver enables applications to open, query, and update data in Visual FoxPro and earlier versions of FoxPro through the Open Database Connectivity (ODBC) interface. Visual FoxPro 9.0 is an object-oriented relational database management system. 3.7 (303 votes) 9.0.7423 Microsoft. Review Comments (3) Questions & Answers (4.

-->

This article introduces how to programmatically modify a report file to change the font color of a field.

Original product version: Visual FoxPro
Original KB number: 188403

Visual FoxproVisualWindows

Summary

It may be desirable to change report fields programmatically to differentiate values or to otherwise modify the format depending on a condition. This article demonstrates how to change the font color of a report field based upon the sales totals of an individual salesperson. While this technique works in Microsoft Visual FoxPro 9.0 Professional Edition, you can obtain the same results by using Report Listener and event-driven printing.

More information

Foxpro Download Free

The following creates a table, populates the table and runs a sales report, changing the font color to reflect sales totals. To change the color of a report field, the PenRed, PenGreen, and PenBlue fields of the report field's record are modified. This method could be used to also change the font style, font size or even to reposition the field. In addition, an entire class of objects could be changed, using REPLACE ALL <property field> WITH <property value> FOR objtype = 8, for instance.

Foxpro For Windows 10 Download

  1. Save the following code in a program file named Maketabs.prg and run the program to create and populate a table.

    Sample Code

  2. Create a report. In the Page Header band, add a report field and make the expression salestot.id. In the Detail band, add a report field and make the expression salestot.invamt. In the Page Footer band, add a report field and make the expression salestot.invamt. Click the Calculations button in the Report Expression dialog box. Select Sum, click OK, and then click OK again. Save the report as Sales.frx.

  3. Save the following code in a program file named Sales.prg and run the program:

  4. As each report is previewed, scroll to the bottom to see the summary and observe how the color changes for each salesperson.