Article ID: 147882 - View products that this article applies to.
This article was previously published under Q147882
Some improvements have been made to the data control in Microsoft Visual Basic version 4.0 and higher for Windows. One of these improvements is the capability to assign back the results of a Recordset object to the data control itself. This was not possible in Microsoft Visual Basic version 3.0 for Windows.
This article demonstrates how to assign a Table-type, Dynaset-type, or Snapshot-type Recordset object back to a data control's Recordset property.
The OpenRecordset method has three possible types of records that it can produce. Below is a portion of the Visual Basic Online Help that describes the Openrecordset method that mentions these three types:
dbOpenTable to open a table-type Recordset object.
dbOpenDynaset to open a dynaset-type Recordset object.
dbOpenSnapshot to open a snapshot-type Recordset object.
Also, the following was taken directly from Chapter 4 of the "Guide to Data Access Objects" book contained in the "Professional Features" Visual Basic manual:
When you open a database using the data control, a Recordset object is automatically created based on the control's RecordSource property. You can address this Recordset with the following syntax:
All of the Recordset properties and methods discussed in this chapter can be used with the data control's Recordset. In addition, you can assign the data control's Recordset object to any Recordset variable you create. For example:
Conversely, you can assign a Recordset object that you create programmatically or with a data control to another data control, using the following syntax:
When you assign a new Recordset object to the data control's Recordset property, you must use the data control's Refresh method to rebuild the Recordset and allow the data control to properly display it. In addition, you must make sure that the DataField property of all bound controls attached to the data control reflect valid fields in the new Recordset.
Article ID: 147882 - Last Review: July 1, 2004 - Revision: 2.1
Contact us for more help