PRB: Method 'Open' of Object '_Recordset' Fails with Jet OLEDB Provider

Symptoms

When you use the Jet OLE DB Provider version 4.0, an application may fail with the following error message:
Run-Time Error -2147467259 (80004005) Method 'Open' of Object '_Recordset' Failed.

This error occurs when trying to issue certain queries to the database.

Cause

In Jet 4.0 there is a new property called ExtendedAnsiSQL. The Jet OLEDB Provider version 4.0 turns on this new ANSI flag to enable new SQL syntax. Because the ExtendedAnsiSQL flag is turned on, Jet 4.0 uses the reserved words list defined by the SQL-92 standard. If the user tries to use a SQL-92 reserved word as an unquoted object name, an error is returned.

Resolution

To work around this problem, try one of the following:

  • Change the name of the field in the database so that it does not use one of the reserved words define by the SQL-92 standard.

  • Place square brackets ([]) around the reserved word in the query. This allows the query to be executed even though the reserved word is in use. For example, "SELECT Usage From Table1" would become "SELECT [Usage] From Table1."

Status

This behavior is by design. The Microsoft Jet 4.0 OLEDB Provider relies on this setting and it cannot be disabled.

More Information



For a list of all the reserved words that Jet now enforces when this ANSI flag is turned on, refer to the following Microsoft Knowledge Base article:
248738 INFO: Microsoft Jet 4.0 Reserved Words
Propriétés

ID d'article : 238243 - Dernière mise à jour : 4 août 2008 - Révision : 1

Commentaires