PRB: Dynaset, Snapshot, and Table Objects No Longer Available

Article translations Article translations
Article ID: 129883 - View products that this article applies to.
This article was previously published under Q129883
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page


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.


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.


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)

  • 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:

    1. Choose References from the Tools menu in Visual Basic.
    2. Clear the Microsoft DAO 3.0 Object Library selection.
    3. Select the Microsoft DAO 2.5/3.0 Compatibility Library.


This behavior is by design.


Steps to Reproduce Behavior

With the Microsoft DAO 3.0 Object Library selected in Tools REFERENCES

  1. Start a new project in Visual Basic. Form1 is created by default.
  2. Add a Data Control (Data1) to Form1.
  3. Add the following code to the Form1_Click procedure:
       Sub Form1_Click()
          Dim ds As dynaset  'this generates "User-defined type not defined"
          Data1.Databasename = "Biblio.MDB"
          Data1.RecordSource = "Authors"
          Set ds = Data1.Recordset.CreateDynaset()
          ' If ds is Dim'd as a RecordSet,
          ' this generates "Feature not available"
          Set ds = Nothing
       End Sub
  4. Start the program by choosing Start from the Run menu or by pressing the F5 key. The 3251 error will be generated on the CreateDynaset line.


Article ID: 129883 - Last Review: February 24, 2014 - Revision: 2.0
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 16-bit Enterprise Edition
  • Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
kbnosurvey kbarchive kbprb KB129883

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from