When the form containing the ADO Data Control loads into memory, the ADO
Data Control will connect to data using the ConnectString property and return a Recordset
fitting the specifications of the RecordSource property.
To see any of the information in the records, you will have to put VB controls
on the form and bind them to specific fields in the ADO Data Control's Recordset. Follow
these steps to bind controls to the ADO Data Control's Recordset:
STEP BY STEP
8.6 Binding Controls to the ADO Data Control's Recordset
Place a VB control such as a TextBox on the form.
In the control's Properties window, activate the drop-down list on the DataSource property.
The list will include the names of any ADO Data Controls on the current form, any Data
Environment Designers in the current project, and any other types of DataSource (such
as RDO or DAO Data Controls) available to this control (see Figure 8.21).
FIGURE 8.21 Setting the DataSource property for a control that you will bind to an ADO
Data Control or another data source.
Choose as the DataSource the ADO Data Control whose Recordset you want to bind
this control to.
Now set the control's DataField property by activating the drop-down list belonging
to the DataField property in the Properties window. You should see a list of fields
available from the ADO Data Control's Recordset. Choose the field that you want to bind to
this control (see Figure 8.22).
FIGURE 8.22 Setting the DataField property of a bound control.
The control is now bound to the desired field in the Recordset.
After you have bound controls to the ADO Data Control, you can run the project
to test the connection. You should see data from the Recordset displayed in the bound controls.
When you click the ADO Data Control's navigation buttons, you should see the contents
of the bound controls change as the Recordset's cursor move through different records.
Depending on the cursor options that you have chosen, you might also see that
you can make changes to the underlying data fields by changing the contents of
the bound controls