DataMembers Property, Add Method Example

The example adds two data members to a DataMembers collection using the Add method.

Option Explicit
' Declare object variables for ADO recordsets, and a Connection object.
Private WithEvents rsProducts As ADODB.Recordset
Private WithEvents rsSuppliers As ADODB.Recordset
Private cnNwind As ADODB.Connection

Private Sub Class_Initialize()
   ' Add DataMember names to the DataMembers collection.
   With DataMembers
      .Add "Products"
      .Add "Suppliers"
   End With

   ' Set Recordset objects.
   Set rsProducts = New ADODB.Recordset
   Set rsSuppliers = New ADODB.Recordset

   ' Code to open recordsets not shown.
   
End Sub