Example

Adding Records using a Form.


Add a new record using a form code snippet.

The following is a simple example of how to add a record to a recorset using a form instead of adding the record directly from the grid.  The code snippet assumes an open recordset named "rs" and a DGrid control named "DGrid1" sited on Form1.


    'Display a form to collect field values
    'add the new record to the recordset
    rs.AddNew
    rs.Fields(0) = Text1.Text
    rs.Fields(1) = Text2.Text
    rs.Fields(2) = Text3.Text
    rs.Update
    'call the Refresh method to update the grid on Form1.
    Form1.DGrid1.Refresh