Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SET CARRY, Set(“Carry”)

SET CARRY lets you specify that the values of certain fields should be repeated in newly added records. SET(“CARRY”) indicates whether you’re working in that mode.

Usage

SET CARRY ON | OFF
SET CARRY TO [ FieldList [ ADDITIVE ] ]
cCarry = SET( "CARRY" )

Parameter

Value

Meaning

FieldList

Comma-delimited list of fields

The fields whose values should be carried forward to new records.

Omitted

Resets the list of fields to be carried forward to include all fields.

cCarry

"ON"

CARRY is currently ON.

"OFF"

CARRY is currently OFF.

When you SET CARRY ON, the values of the specified fields are copied into new records. SET CARRY affects records added with INSERT and APPEND, and records added in a grid, BROWSE (or EDIT).

Issuing SET CARRY TO automatically turns CARRY ON. The ADDITIVE clause says to add the fields in FieldList to the existing list of fields to be carried forward. If you omit ADDITIVE, the new list replaces the current list.

SET CARRY ON or OFF affects all open tables, but the list of fields applies only to the table in the current work area and is maintained separately for each data session. (That last seems pretty funny since we can’t actually imagine giving an end user access to anything that respects SET CARRY.) SET CARRY does not apply to grids.

You can list memo fields in SET CARRY, but their values aren't carried forward.

SET CARRY can be very handy for interactive data entry, but we don’t think it belongs in an application.

Example

USE MyLogTable          && a table for logging hours spent
SET CARRY TO dLogDate
BROWSE                  && now enter today's log entries

SET(“CARRY”) returns either “ON” or “OFF” to indicate the current setting.

Unfortunately, although you can pass a second (numeric) parameter, it still returns "ON" or "OFF". There's no way to get the current list of fields to carry forward. Seems to us that SET("CARRY",1) ought to do this.

See Also

Append, Browse, Insert, Set, Set()