ACC2000: No Error Message Occurs with Multiple Dynaset.Close Statements Based on a Form (209732)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q209732
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access database (.mdb).

SYMPTOMS

If you use code to create a recordset that is based on a form, you can use multiple Dynaset.Close statements without generating the expected error message.

MORE INFORMATION

NOTE: The Dynaset property is included in Microsoft Access 2000 only for compatibility with earlier versions. It is recommended that you use the RecordsetClone property instead. In Microsoft Access 7.0, 97, and 2000, there is no Dynaset object; therefore, you cannot declare a variable as a Dynaset.

Steps to Reproduce Behavior

  1. Start Microsoft Access and open the sample database Northwind.mdb.
  2. Open the Customers form in Form view.
  3. Create the following new module.
    Function MultiClose()
       Dim MyDyna as Recordset
       Set MyDyna=Forms![Customers].Dynaset
       MyDyna.Close
       MyDyna.Close
    End Function
    					
  4. If the Immediate window is not already visible, click Immediate Window on the View menu, or press CTRL+G.
  5. Run the code that you created in step 3 by typing ? MultiClose() in the Immediate window. Note that there are no error messages, even though the code attempts to close the Dynaset more than once.

REFERENCES

For more information about Dynaset and DAO object compatibility, click Microsoft Access Help on the Help menu, type dao object library compatibility in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MinorLast Reviewed:7/15/2004
Keywords:kbprb kbprogramming KB209732