PRB: Default Property of Dynaset Different in VB 4.0 (141173)
The information in this article applies to:
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q141173 SYMPTOMS
Code that doesn't refer explicitly to the Name property of the dynaset
object, but instead uses the dynaset's old default property, Name, compiles
and runs correctly when using Visual Basic 3.0. However, the compilation
fails under Visual Basic 4.0, stopping and giving a "Type mismatch" error
on lines where the default property is used.
CAUSE
With Visual Basic 4.0, the default value of the dynaset object is no longer
the Name property. When you refer to a dynaset object without referring to
any properties, Visual Basic 4.0 interprets this to be a reference to the
dynaset object itself.
RESOLUTION
Change the code to refer explicitly to all properties. When assigning a
string to the RecordSource property of a data control, instead of using
Dim ds as Dynaset
Data1.RecordSource = ds
use the following:
Dim ds as Dynaset
Data1.RecordSource = ds.Name
NOTE: The Dynaset object is provided for backwards compatibility. Use of
the new enhanced RecordSet object is recommended.
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 1/8/2003 |
---|
Keywords: | kbprb KB141173 |
---|
|