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.

ACC2000: Cannot Use ADOX Views Collection with SQL Server or MSDE


View products that this article applies to.

This article was previously published under Q225939
Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access project (.adp).

For a Microsoft Access 2002 version of this article, see 292791 (http://support.microsoft.com/kb/292791/EN-US/ ) .

↑ Back to the top


Symptoms

When you try to examine properties of the ADOX Views collection connected to SQL Server or Microsoft Data Engine (MSDE) via the OLE DB Provider for SQL Server (SQLOLEDB), you may receive the following error message:
Run-time error '3251':

The operation requested by the application is not supported by the provider.

↑ Back to the top


Cause

The OLE DB Provider for SQL Server does not support the VIEWS schema rowset, which is necessary to provide ActiveX Data Objects (ADO) with information on views that exist in a database that resides on SQL Server or MSDE.

↑ Back to the top


Resolution

In a Microsoft Access project connected to the database that you want to query, use the AllViews collection of the CurrentData property to return basic information about views in your database. There currently is no way to examine remote views via ADO from a Microsoft Access database.

Using the AllViews collection

  1. Open an Access project connected to any SQL Server or MSDE database.
  2. Create a new module.
  3. On the Tools menu, click References.
  4. Verify that the Microsoft ActiveX Data Objects 2.1 library is selected.
  5. Close the References dialog box.
  6. Press CTRL+G, and in the Immediate window, type the following:
    Debug.Print CurrentData.AllViews.Count
    					

↑ Back to the top


More information

Steps to Reproduce the Behavior


  1. Open an Access project connected to any SQL Server or MSDE database.
  2. Create a new module.
  3. On the Tools menu, click References.
  4. Select the Microsoft ActiveX Data Objects 2.1 and the Microsoft ADO Ext. 2.1 for DDL and Security libraries.
  5. Close the References dialog box, and in the newly created module, add the following procedure:
    Sub TestCountViews()
        
        Dim cat As New ADOX.Catalog
        Set cat.ActiveConnection = CurrentProject.Connection
        Debug.Print cat.Views.Count
    
    End Sub
    					
  6. Run the procedure.

↑ Back to the top


References

For more information about the AllViews collection, click Microsoft Access Help on the Help menu, type allviews property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB225939, accesscs, kbclientserver, kbprb, kbdta, kberrmsg

↑ Back to the top

Article Info
Article ID : 225939
Revision : 1
Created on : 12/12/2002
Published on : 12/12/2002
Exists online : False
Views : 304