When the user makes changes to controls and you want to save to the underlying
data, you must programmatically write the contents of a control back to the underlying
data in two steps:
-
Write the contents of each control to its corresponding field in the copy buffer.
-
Save the contents of the copy buffer to the underlying data of the Recordset.
To update a field in the copy buffer with a control's contents, you
might code the following:
RecordsetName![FieldName] = ControlContents
If you want to write the Last Name field of rsEmployees that you read in the
last section, for example, you could write:
rsEmployees![Last Name] = txtLastName.Text
You would typically write a general procedure to write controls to their corresponding
fields, with one line of code similar to the preceding example for each control-field
assignment (see Listing 8.6 in the section titled "Updating
a Record"). You could call this procedure as the first step in saving data
from controls in the Recordset's underlying data.
The second phase of writing to a record requires the use of the Recordset's
Update method. This phase is discussed in the following section,
"Updating a Record."