Creating a Report with Highlights on Every Other Line

Last reviewed: June 27, 1995
Article ID: Q102934
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.5

SUMMARY

In FoxPro 2.5 for Windows, you can use the Report Writer to create a report with every other line highlighted, as shown below.

MORE INFORMATION

The following two methods demonstrate how to create a report like the one on page U14-39 in the "User's Guide."

Method 1

NOTE: This method should be used on a database with no order set.

  1. In the Command window, enter:

          USE customer.dbf
          CREATE REPORT TEST
    

  2. From the toolbar in the report, click the rounded rectangle icon then click and drag in the report screen to draw a rectangle with rounded corners in the Detail band. Size the rectangle to fit the field you want highlighted.

  3. Double-click the rectangle. In the Round Rectangle dialog box, select the Print When check box.

  4. In the Print When dialog box, select the "Print only when expression is true..." check box.

  5. In the Expression Builder dialog box, enter

          (recno()/2)=int(recno()/2)
    

          -or-
    

          recno() % 2 = 0
    

    then click three OK buttons to return to the report window.

  6. With the rectangle object selected, choose Fill from the Object menu, and select the desired color.

  7. From the Object menu, choose Mode, and select Transparent.

  8. Create a field by clicking the third icon in the toolbar. Place it on top of the rectangle.

  9. From the Report menu, choose Page Preview to see the results of these steps.

Method 2

NOTE: This method can be used on a database based on any index order.

  1. Follow steps 1-4 in Method 1.

  2. In step 5 above, replace the expression with the following:

          MOD(mycount,2)=0
    

  3. From the Report menu, choose Variables, and choose the Add button, then enter the following information in the Variable Definition dialog box:

          Variable name:  mycount
    
          Value to Store:   mycount+1
          Calculation:  None
          Initial Value:  0
          Reset:  End of Report
    


Additional reference words: FoxWin 2.50 RWriter
KBCategory: kbprg
KBSubcategory: FxtoolRwriter


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.