Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

REPORT Command

Visual Studio .NET 2003

Displays or prints a report under the control of a report definition file created with MODIFY REPORT or CREATE REPORT.

REPORT FORM FileName1 | ? [ENVIRONMENT] [Scope] [FOR lExpression1]
   [WHILE lExpression2] [HEADING cHeadingText] [NOCONSOLE]
   [NOOPTIMIZE] [PLAIN] [RANGE nStartPage [, nEndPage]]
   [TO PRINTER [PROMPT] | TO FILE FileName2 [ASCII]] [NAME ObjectName]


Specifies the name of the report definition file to print. In this version of Visual FoxPro, this parameter is also reported to the Print Spooler dialog box.
Displays the Open dialog box, from which you can choose a report file.
Included for backward compatibility with 2.x reports. To restore the data environment associated with a Visual FoxPro report, set the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the report environment is closed when the report is finished printing, set the data environment AutoCloseTables property to true (.T.), which is also the default.

For reports converted from earlier versions of FoxPro, including ENVIRONMENT opens and restores all the tables and relations in the Data Environment even if AutoOpenTables is set to false (.F.).

When you create or modify reports, you can save the current Visual FoxPro data environment with the report definition file. Saving the Visual FoxPro data environment places additional records in the report definition table for all open tables and index files, the index order, and any relationships between the tables.

Specifies a range of records to include in the report. Only the records that fall within the range are included in the report.

The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see the Scope Clauses and Overview of the Language online topics.

The default scope for REPORT is ALL records.

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.

Rushmore optimizes REPORT FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and Using Rushmore to Speed Data Access.

WHILE lExpression2
Specifies a condition whereby data is printed for as long as the logical expression lExpression2 evaluates to true (.T.).
HEADING cHeadingText
Specifies text for an additional heading to be placed on each page of the report. The PLAIN clause takes precedence if you include both HEADING and PLAIN.
Suppresses the echoing of a report to the main Visual FoxPro window or to a user-defined window when the report is being printed or sent to a file.
To prevent Rushmore optimization of REPORT, include NOOPTIMIZE.

For more information, see SET OPTIMIZE and Using Rushmore to Speed Data Access.

Specifies that a page heading appears only at the beginning of the report.
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.
Displays the report in page preview mode instead of sending the report to the printer. To print a report, you must issue REPORT with TO PRINTER.

System variables are ignored when you include PREVIEW.

You can include the optional WINDOW or IN WINDOW clause to specify a window in which the report is previewed. WindowName can be the name of a window created with DEFINE WINDOW. If you include the WINDOW clause, the preview assumes the characteristics (title, size, and so on) of the window you specify with WindowName. If you include the IN WINDOW clause, the report is previewed in the window you specify with WindowName.

You can include the optional IN SCREEN clause to specify that the report preview window is contained in the main Visual FoxPro window and cannot be moved outside it.

You can include the optional NOWAIT clause so that at run time Visual FoxPro does not wait for the page preview window to be closed before continuing program execution. Instead, Visual FoxPro continues program execution while the page preview window is open.

In a distributed application, be sure that the View menu is available. If the Print Preview toolbar is closed, it cannot be restored unless the View menu is available.

Sends a report to the printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a printer settings dialog box before printing starts. The printer settings that you can adjust depend on the currently installed printer driver. Place PROMPT immediately after TO PRINTER.

Specifies the text file to which you send a report. The current printer driver is used when the report is sent to the text file. The file created when you include TO FILE has the default extension .txt.

You can include the optional ASCII clause to create an ASCII text file from the report definition file. Without the ASCII clause, PostScript and other printer codes are written to the text file. Any graphics, lines, rectangles, or rounded rectangles in the report definition do not appear in the ASCII text file.

The number of columns and rows on each page in the ASCII text file is determined by the contents of the _ASCIICOLS and _ASCIIROWS system variables. The default values for _ASCIICOLS and _ASCIIROWS are 80 columns and 63 rows respectively. These values correspond to a standard portrait page.

NAME ObjectName
Specifies an object variable name for the data environment of a report. The data environment and the objects in the data environment have properties and methods, for example AddObject, that need to be set or called at run time. The object variable provides access to these properties and methods. If you don't specify a NAME, Visual FoxPro uses as a default the name of the report file that can be referenced in the code associated with the events.
Suppresses detail line printing. Only totals and subtotals are printed.


The default extension for a report definition file is .frx. If the report definition file is not in the default directory or folder, the path must also be included with the file name.

See Also


© 2015 Microsoft