What About When Our Record Source Isn't a Table?
Since we are opening a table, all of the properties we need are available to us. However, if we opened the ADO recordset as
adCmdText so we would pass an SQL command, we would not know ahead of time if these properties were available from the data source. If we did not know, we could use the
Supports property of the ADO record source and test for what we need. VB will show us the list of enumerated Cursor options for that recordset. We would then have to test for each of the particular options we needed. If the property were not supported, we would have to write code to handle it:
So instead of adding a lot of extra code that would take away from the essence of the control, for now we will permit the user to only select tables. Once the control is working, you could easily test to see if the recordset supported bookmarks, etc. using this property. Then you could enhance the control to handle any SQL statement. But since we are opening a table, we know that the properties we need are supported.