To write the contents of a Recordset object's copy buffer to its underlying
data, you must follow these steps:
-
Write to each field in the copy buffer, as described in the preceding section.
-
Call the Recordset's Update method.
Listing 8.6 illustrates using these steps to update a record. To review the
purpose of the WriteEmployeeRecord procedure, refer
to the above section, "Programmatically Writing
VB Controls to a Record."
LISTING 8.6
ROUTINES FOR WRITING DATA FROM CONTROLS BACK TO THE DATABASE
Sub UpdateRecord
'write controls to buffer
WriteEmployeeRecord
'call the Update method
rsEmployees.Update
End Sub
Sub WriteEmployeeRecord()
rsEmployees![First Name] = txtFirstName.Text
rsEmployees![Last Name] = txtLastName.Text
rsEmployees!Department = txtDepartment.Text
rsEmployees!PhoneExt = txtPhoneExt.Text
rsEmployee![Full Time]= chkFullTime.Value
End Sub