
Copyright Scott L. Erlichman, Vital-Link Technologies, Inc.

=============================================================================

Remember how convenient the SCATTER and GATHER routines were in
FoxPro's XBASE.  This file is the answer.

the SCATTER and GATHER routines included in this file allow the
following:

        - Automatically clearing unbound form controls that coorespond
          to a field in a recordset.
        - Automatically loading the current recordset record into the
          cooresponding unbound form controls.
        - Automatically loading unbound form control data into a
          recordset.

Combining these routines allows programmers to design an interface where
the user is entering data into form controls, not directly into the
recordset.  This allows for better performance and control over recordset
data.

=============================================================================

The functions are as follows:

Syntax:
 
 sleScatter(Action as Integer, RecordsetName as Variant, FormName as Variant)

Parameters:

     Action:    1 - Loads current recordset record information into
                    cooresponding unbound form controls.  Note that
                    the recordset must be opened and the current record
                    must be set to the record to be loaded.
                2 - Clears unbound form controls that coorespond to
                    fields in the recordset.  If a control DefaultValue
                    exists, the control will be set to that value.  This
                    method does not require the recordset to be opened.
     
     RecordsetName: A string representing the name of the recordset that
                    the sleScatter routine is associated with.

     FormName:      A string representing the opened form  containing
                    the controls to work with.

Return:

 -1 on Success
  0 on Failure

  Note:  The routine currently uses a Message Box to notify the user
         of an error.

=============================================================================

Syntax:
 
 sleGather(MyRs as Recordset, FormName as Variant)

Parameters:

     MyRs:          The opened Recordset to submit form control data to.

     FormName:      A string representing the opened form  containing
                    the controls to work with.

 Note:  This routine is typically called after a
        MyRs.AddNew or MyRs.Edit command, and is
        followed by a MyRs.Update command.

Return:

 -1 on Success
  0 on Failure

  Note:  The routine currently uses a Message Box to notify the user
         of an error.

============================================================================

Remarks:

 These routines only work with unbound controls.  The controls must have
 the same name as their recordset counterparts.  The ControlSource property
 must be Null.

Example:

 For an example of these routines, examine the code in
        Form:    "frm Customer"
 
 Notice how all of the text box controls have the same
 name as the fields in the Customer table.

 Examine the code attached to the OnClick event of the
 two push buttons.  This code demonstrates how simple
 these routines are to use.

============================================================================

Modification and Distribution Rights:

You may use and modify this code as necessary.  This code is not
warrantied.  Vital-Link Technologies, Inc. is not liable for any
results of using this code.

If you have any comments or suggestions, please notify me via E-Mail:
                
                Internet:       serlich@ibm.net
                CompuServe:     75030,1663

Thank You,

Scott L. Erlichman
