PRB: Changes to the Filter property in a hierarchical recordset appears to be read-only (331917)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- ActiveX Data Objects (ADO)
This article was previously published under Q331917 SYMPTOMSIn a hierarchical recordset, changes that are made to the Filter property on the chapter field are lost. The changes do not affect
the original chapter. The property appears as read-only. However, no errors or
warnings are produced. STATUS This
behavior is by design.RESOLUTIONTo resolve this problem, create a variable that is populated
by referencing the chapter field. The following example demonstrates the
behavior. In the example, a new recordset object variable holds reference to
the resultant filtered recordset. The AbsolutePosition property also shows similar behavior. When you issue
the following command rs.Fields("Orders").Value.Filter = "OrderId = 3" the following sequence of events occurs:
- rs.Fields("Orders").Value causes Microsoft ActiveX Data Objects (ADO) to open a handle over
the child chapter. The Orders value in the rowset that is wrapped by the parent rowset is a
chapter handle, and not a rowset or recordset. The child recordset is an ADO
construction over the child rowset or the chapter handle, or both.
- .Filter = "OrderId = 3" sets the filter on the newly opened recordset to "OrderId =
3".
- ADO closes the child recordset by removing the reference
to the filtered recordset. Therefore, the Filter property is lost.
There were no errors because the Filter property was successfully set, and the recordset was destroyed
automatically. REFERENCES For additional information, click the following article
numbers to view the articles in the Microsoft Knowledge Base: 230167
BUG:DataCombo/DataList Not Displaying Recordset with
Sort/Filter
249097 HOWTO:
Re-Shape a Hierarchical Recordset
196968 PRB: SHAPE
Provider Pulls Down All Records in Child Table
189657 HOWTO: Use
the ADO SHAPE Command
213856 INFO:
Using Disconnected Hierarchical Recordsets
191744 HOWTO:
Extract Child Recordsets from Shaped Recordset
Modification Type: | Major | Last Reviewed: | 2/3/2004 |
---|
Keywords: | kbDataBinding kbDatabase kbFilter kbVBX kbWindowsForms kbprb KB331917 kbAudDeveloper kbAudITPRO |
---|
|