Sub cmdConnect_Click()
    ' Declare and instantiate the object variables
    Dim cnStateUBookstore As Connection
    Dim rsStudents As Recordset
    Set cnStateUBookstore = New Connection
    Set rsStudents = New Recordset

    ' Establish a connection
    With cnStateUBookstore
        .Provider = "SQLOLEDB"
        .ConnectionString = "User ID=sa;" & _
                            "Data Source=MSERIES1;" & _
                            "Initial Catalog=StateUBookstore"
        .Open
    End With

    ' Open a recordset using the Execute method
    Set rsStudents = cnStateUBookstore.Execute("SELECT StudentID FROM Students")
End Sub