PRB: Dynaset, Snapshot, and Table Objects No Longer Available (129883)
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
This article was previously published under Q129883 SYMPTOMS
If you try to dimension a Dynaset, Snapshot, or Table object variable and
using DAO 3.0 (Visual Basic version 4.0 data access objects), you will
receive this runtime error:
User-defined type not defined.
If you replace the Dynaset, Snapshot, or Table object with the Object or
RecordSet type and use methods such as CreateDynaset, CreateSnapshot, or
OpenTable that are tied to the Dynaset, Snapshot, or Table types, you will
receive this error:
Feature not available.
CAUSE
Visual Basic version 4.0 has replaced the older Dynaset, Snapshot, and
Table objects with a single RecordSet object. This object can take on the
attributes of any of the older three making it much more powerful and
flexible.
RESOLUTION
You can resolve this problem one of two ways. - Replace references to the older objects, while retaining lines of code
such as these:
Dim DB As Database
Set DB = OpenDatabase("Biblio.mdb")
For example, instead of this old code:
Dim DS As Dynaset
Dim SS As Snapshot
Dim TB As Table
Set DB = OpenDatabase("Biblio.mdb")
Set DS = DB.CreateDynaset("Authors")
Set SS = DB.CreateSnapshot("Authors")
Set TB = DB.OpenTable("Authors")
Use this new code:
Dim DB As Database
Dim RS1 As Recordset
Dim RS2 As Recordset
Dim RS3 As Recordset
Set DB = OpenDatabase("Biblio.mdb")
Set RS1 = DB.OpenRecordset("Authors", dbOpenDynaset)
Set RS2 = DB.OpenRecordset("Authors", dbOpenSnapshot)
Set RS3 = DB.OpenRecordset("Authors", dbOpenTable)
-or-
- Retain the older syntax and change the Data Access Object (DAO) Type
Library that your program uses. Although Microsoft recommends the first
method for future compatibility, using the older syntax is useful for
compiling code written in previous versions of Visual Basic in version
4.0 with a minimal number of changes. To change the DAO Type Library:
- Choose References from the Tools menu in Visual Basic.
- Clear the Microsoft DAO 3.0 Object Library selection.
- Select the Microsoft DAO 2.5/3.0 Compatibility Library.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbprb KB129883 |
---|
|