The ADO Data Control Example

Lets take a look at the ADO Data Control with an example. We will be using the ADO Data Control to bind text-box controls to the Publishers table of the Biblio.mdb Access database file. Figure D-16 shows the ADO Data Control Example during runtime.

The ADO Data Control Example

Figure D-16. The ADO Data Control Example

To begin, place the controls shown in Figure D-17 onto a form. This includes an ADO Data Control, ten labels, ten text boxes, and three command buttons.

Begin by setting the properties for the ADO Data Control. You can use the steps outlined earlier to create a Data Link File that points to the Biblio.mdb database file. After you have created a Data Link File, you can use the Custom property of the ADO Data Control to point to that Data Link File through the first tab of the dialog box, the General tab (shown in Figure D-1). Then switch to the RecordSource tab (shown in Figure D-3) to set the CommandType property to adCmdTable and the Table property to Publishers.

The ADO Data Control Example in Design mode

Figure D-17. The ADO Data Control Example in Design mode

Now you are ready to set the rest of the properties as specified in Table D-4.

Notice that the two properties that are being selected for all of the text boxes are DataField and DataSource. First choose the DataSource property for the text box from the drop-down ...

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.