Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> closearea() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    CLOSEAREA()

Purpose:     Close multiple database work areas with one command.

Syntax:      CLOSEAREA( [ area [, area ...  ] ] )

Arguments:   area        - Character or numeric work area to close.  If
                           <area> is character, it must be a valid alias
                           name of an open work area.  If <area> is a
                           number, it must be a valid select area number.
                           If no arguments are given, the current work
                           area is closed.

Returns:     True if the requested work areas have been closed.

Description: CLOSEAREA() allows you to close up to nine database files at
             one time with one line of code without having to leave the
             currently selected work area.  This is useful when you have
             several database files open and you want to close all but one
             or two of them.

Notes:       Select area numbers and work area Alias names may be
             intermixed as arguments.  Up to nine areas may be specified.
             If no argument is given, this will be the same as issuing the
             USE command, closing the current work area.

             CLOSEAREA() steps through the work areas specified and issues
             a USE command to close the database.  After all is finished,
             control is returned to the selected work area at entry.  A
             return value of .F. should only occur if an invalid argument
             is passed (i.e.  a Date, Memo, or Logical type parameter) or
             if you specify an alias name that does not exist.  Normally
             an invalid alias name will trigger a TYPE MISMATCH runtime
             error, so CLOSEAREA() tests any alias names for their proper
             existence.

Example:     If you had seven databases open and wanted to close all but
             the databases in work areas 1 and 3 (aliases SALES and
             CUSTOMERS), one of the ways to accomplish this task would be
             with the following code:

             SELECT 1
             marker1 = RECNO()
             SELECT 3
             marker3 = RECNO()
             CLOSE DATABASES
             SELECT 1
             USE Sales INDEX Sales ALIAS Sales
             GOTO marker1
             SELECT 3
             USE Cust INDEX Cust ALIAS Customers
             GOTO marker3


             *-- Another way to do this would be as follows:

             SELECT 2             && Invoices
             USE
             SELECT 4             && Payments
             USE
             SELECT 5             && Payables
             USE
             SELECT 6             && Inventory
             USE
             SELECT 7             && Ledger
             USE

             *-- With CLOSEAREA(), the following is a LOT easier and
             *-- simpler!!!

             CLOSEAREA(2, 4, 5, 6, 7)

             *-- or, even more readable is:

             CLOSEAREA("Inovices", "Payments", "Payables", 6, "Ledger")

             *-- This example shows how you can mix numeric and character
             *-- arguments.

Source:      RL_CLOSE.PRG

See also:    OPENED()

See Also: OPENED()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson