Share via


The CSectionForm Record View Class (DAO)

CSectionForm is derived from CDaoRecordView, which is one of the MFC record view classes. A record view is a specialized class that uses controls laid out in a dialog template resource to view and/or edit the fields of a recordset in a dialog-like form. A CDaoRecordView object is associated with both (a) a recordset object and (b) a dialog template resource. The dialog template resource has an ID of the form IDD_XXX_FORM, where XXX is based on the project name. CDaoRecordView derives its behavior from class CFormView. CDaoRecordView supports navigation through records, one record at a time, using commands in the associated CDaoRecordset object. When you update the value in a control on the form and navigate to another record, the corresponding recordset field is automatically updated.

Suggested Reading in the Visual C++ Programmer’s Guide

To examine the source code for the record view class

  • Use ClassView to jump to the OnInitialUpdate member function of class CSectionForm.

    SectForm.cpp opens in the text editor, with your cursor just before the OnInitialUpdate member function:

    void CSectionForm::OnInitialUpdate()
    {
    m_pSet = &GetDocument()->m_sectionSet;
    CDaoRecordView::OnInitialUpdate();
    }
    

    The base class framework function CDaoRecordView::OnInitialUpdate opens the database if it is not already open, then opens the recordset, and initializes the form by calling CFormView::OnInitialUpdate.

For now, the “form” represented by class CSectionForm is empty of controls. Later, in Customizing the Dialog Template for the DaoEnrol Section Form, you’ll use the dialog editor to design the form and to map controls on the form to the recordset.