Prints labels from a table file and a label definition file.
LABEL [FORM FileName1 | FORM ?] [ENVIRONMENT] [Scope] [FOR lExpression1] [WHILE lExpression2] [NOCONSOLE] [NOOPTIMIZE] [PDSETUP] [PREVIEW [NOWAIT]] [NAME ObjectName] [TO PRINTER [PROMPT] | TO FILE FileName2]
- FORM FileName1
- Specifies the name of a label definition file whose labels you want to print. The default extension for a label definition file is .lbx. If the label definition file is on a drive or volume other than the default or in a directory other than the current directory, you must also specify the drive designator and directory.
- FORM ?
- Displays the Open dialog box from which you can choose an existing label file.
- Included for backward compatibility with 2.x labels. To restore the data environment associated with a Visual FoxPro label, set the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the label environment is closed when the label is finished printing, set the data environment AutoCloseTables property to true (.T.), which is also the default.
When you create or modify labels, you can save the current Visual FoxPro data environment with the label definition file. Saving the Visual FoxPro data environment places additional records in the label definition table for all open tables and index files, the index order, and any relationships between the tables.
- Specifies a range of records. Only the records that fall within the range are printed. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see the Scope Clauses or Overview of the Language online topics. Commands that include Scope operate only on the table in the active work area.
The default scope for LABEL is ALL records.
- FOR lExpression1
- Specifies a condition whereby only the records that satisfy the logical condition lExpression1 are printed. This argument allows you to filter out records you don't want to print.
Rushmore optimizes a query created with LABEL ... FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.
- WHILE lExpression2
- Specifies a condition whereby records are printed for as long as the logical expression lExpression2 evaluates to true (.T.).
- Suppresses the display of label output to the main Visual FoxPro window or to a user-defined window when labels are being printed or sent to a file.
- Disables Rushmore optimization of LABEL.
- Loads a printer driver setup.
In Visual FoxPro, you can include PDSETUP to use a printer driver setup for printing character-based labels created in FoxPro for MS-DOS. PDSETUP is ignored when you print graphics-based labels created in Visual FoxPro.
- PREVIEW [NOWAIT]
- Displays the labels in a preview window before printing, but doesn't print the labels. To print the labels, you must issue LABEL again without the PREVIEW clause.
In Visual FoxPro, 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.
- NAME ObjectName
- Specifies an object variable name for the data environment of a label. 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 label file that can be referenced in the code associated with the events.
- TO PRINTER [PROMPT]
- Sends a label to the printer. You can include the optional PROMPT clause to display the Print dialog box before printing starts.
- TO FILE FileName2
- Sends character-based labels created in FoxPro for MS-DOS to the text file specified with FileName2. The file that is created when you include TO FILE has the default extension .TXT.
Label definition files are created with MODIFY LABEL or CREATE LABEL.
If LABEL is issued without any additional arguments, the Open dialog box appears, displaying a list of existing label files to choose from.