Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

You may receive the "Run-time error 2593" error message when you set or you retrieve the Recordset property of a report in an Access database


View products that this article applies to.

Symptoms

When you set or retrieve the Recordset property of a report in a Microsoft Access database (.mdb), you receive the following error message:
Run-time error '2593':

This feature is not available in an MDB.

↑ Back to the top


Cause

Reports in a Microsoft Access database do not support the use of the Recordset property.

↑ Back to the top


Resolution

You can simulate binding a report to a DAO recordset object by setting the RecordSource property to the name of a table, a query, or an SQL SELECT statement. If you want to use the same source for the report as a DAO recordset that you have opened, set the RecordSource property of the report to the Name property of the DAO recordset. The following example shows you how to open a DAO recordset that is based on a query and how to set the RecordSource property of the report to the same source as the source of the recordset.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
  1. CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

  2. Open the sample database Northwind.mdb.
  3. Close the Main Switchboard form when it appears.
  4. On the View menu, point to Database Objects, and then click Reports.
  5. In the Database window, click the Alphabetical List of Products report, and then click Design.
  6. On the View menu, click Properties to display the property sheet.
  7. On the Edit menu, click Select Report to verify that the property sheet being displayed is the one for the report.
  8. Click the Data tab, and then clear the RecordSource property.
  9. On the View menu, click Code to view the module of the form.
  10. Add the following code to the module:
    Private Sub Report_Open(Cancel As Integer)
        Dim db As DAO.Database
        Dim rs As DAO.Recordset
        
        Set db = CurrentDb
        
        'Open a DAO recordset based on the Alphabetical List of Products query
        Set rs = db.OpenRecordset("Alphabetical List of Products", dbOpenDynaset)
        Me.RecordSource = rs.Name
    End Sub
    					
  11. On the File menu, click Close and Return to Microsoft Access.
  12. On the File menu, click Save, and then close the report.
  13. Open the Alphabetical List of Products report in print preview.
Note that the report is bound to data from the Alphabetical List of Products query, which was the source of the DAO recordset object.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in Microsoft Access.

↑ Back to the top


More information

The Help topic for the Recordset property states that this property applies to reports. This is only true if the report is in a Microsoft Access project (.adp file), and you are binding the report to an ADO recordset or retrieving an ADO recordset from the report. The Recordset property does not apply to reports in a Microsoft Access database (.mdb file).

Steps to Reproduce the Behavior

  1. CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

  2. Open the sample database Northwind.mdb.
  3. Close the Main Switchboard form when it appears.
  4. On the View menu, point to Database Objects, and then click Reports.
  5. In the Database window, click the Alphabetical List of Products report, and then click Design.
  6. On the View menu, click Properties to display the property sheet.
  7. On the Edit menu, click Select Report to verify that the property sheet being displayed is the one for the report.
  8. Click the Data tab, and then clear the RecordSource property.
  9. On the View menu, click Code to view the module of the form.
  10. Add the following code to the module:
    Private Sub Report_Open(Cancel As Integer)
        Dim db As DAO.Database
        Dim rs As DAO.Recordset
        
        Set db = CurrentDb
        Set rs = db.OpenRecordset("Alphabetical List of Products", dbOpenDynaset)
        Set Me.Recordset = rs
    End Sub
    					
  11. On the File menu, click Close and Return to Microsoft Access.
  12. On the File menu, click Save, and then close the report.
  13. Open the Alphabetical List of Products report in print preview. Note that you receive the following error message:
    Run-time error '2593':

    This feature is not available in an MDB.

↑ Back to the top


Keywords: KB287437, kbnofix, kberrmsg, kbbug

↑ Back to the top

Article Info
Article ID : 287437
Revision : 6
Created on : 1/31/2007
Published on : 1/31/2007
Exists online : False
Views : 331