PRB: "Syntax Error in FROM clause" Opening a Jet TableID: Q181489
|
When opening a Microsoft Jet table using ActiveX Data Objects (ADO), the
program displays the following error:
Run-time error '-2147217900 (80040e14)': [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in FROM clause.
The table name is a SQL reserved word, such as "Order".
Change the table name to a non-reserved word, such as "Orders" or place
square brackets around the name as follows:
"[Order]"
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
When using the Microsoft Access ODBC driver from ADO, even if you specify
adCmdTable as the command type, the ODBC driver still passes it back to Jet
as a SQL command.
NOTE: User needs to create a DSN called "NWIND" in the ODBC Data Source Administrator for the following code to work.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN
RISK. Microsoft provides this code "as is" without warranty of any kind,
either expressed or implied, including but not limited to the implied
warranties of merchantability and/or fitness for a particular purpose.
Private Sub Command1_Click()
Dim cn As ADODB.Connection, rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "DSN=NWIND"
Set rs = New ADODB.Recordset
rs.Open "Order", cn, adOpenKeyset, adLockOptimistic, adCmdTable
rs.Close
cn.Close
End Sub
rs.Open "[Order]", cn, adOpenKeyset, adLockOptimistic, adCmdTable
Additional query words: kbdse
Keywords : kbADO kbDatabase kbJET kbVBp600
Version : WINDOWS:1.0,1.5
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: February 26, 1999