Syntax error in FROM clause (ADO) 
Author Message
 Syntax error in FROM clause (ADO)

I have this very very unusual and frsutration problem.
I have an ADO data control on my form.
Now I am trying to connect ado control to an access db.
Now when I connect this ado to any table in this db I have no problem.
But for one simple table when I try to connect, I have this error "Syntax
error in FROM clause"
Now this error occurs when I am trying to bind a text box to the field of
the table, ie. when I am trying to set the Datafield property of the text
box after setting datasource property.

Any clues anybody ???

Abhi



Thu, 28 Oct 2004 03:51:48 GMT  
 Syntax error in FROM clause (ADO)
Can you post the SQL phrase?
OR,
copy and paste it into an SQL view query design in your database (allowing
for minor puncutation changes) and see if it produces an error on any field.


Quote:
> I have this very very unusual and frsutration problem.
> I have an ADO data control on my form.
> Now I am trying to connect ado control to an access db.
> Now when I connect this ado to any table in this db I have no problem.
> But for one simple table when I try to connect, I have this error "Syntax
> error in FROM clause"
> Now this error occurs when I am trying to bind a text box to the field of
> the table, ie. when I am trying to set the Datafield property of the text
> box after setting datasource property.

> Any clues anybody ???

> Abhi



Thu, 28 Oct 2004 04:12:41 GMT  
 Syntax error in FROM clause (ADO)
This is the strangest problem I have ever seen.
Thanks for taking the time to reply, but I was able to solve the problem by
the changing the table name.
so for example my table name was "Order", now when I have changed it to
p_Order it works fine
But if I change p_Order back to Order I have this problem.
Thanks anyway though.

Abhi

Quote:
> Can you post the SQL phrase?
> OR,
> copy and paste it into an SQL view query design in your database (allowing
> for minor puncutation changes) and see if it produces an error on any
field.



> > I have this very very unusual and frsutration problem.
> > I have an ADO data control on my form.
> > Now I am trying to connect ado control to an access db.
> > Now when I connect this ado to any table in this db I have no problem.
> > But for one simple table when I try to connect, I have this error
"Syntax
> > error in FROM clause"
> > Now this error occurs when I am trying to bind a text box to the field
of
> > the table, ie. when I am trying to set the Datafield property of the
text
> > box after setting datasource property.

> > Any clues anybody ???

> > Abhi



Thu, 28 Oct 2004 04:24:09 GMT  
 Syntax error in FROM clause (ADO)
I think probably because Order is a reserved word.


Quote:
> This is the strangest problem I have ever seen.
> Thanks for taking the time to reply, but I was able to solve the problem
by
> the changing the table name.
> so for example my table name was "Order", now when I have changed it to
> p_Order it works fine
> But if I change p_Order back to Order I have this problem.
> Thanks anyway though.

> Abhi


> > Can you post the SQL phrase?
> > OR,
> > copy and paste it into an SQL view query design in your database
(allowing
> > for minor puncutation changes) and see if it produces an error on any
> field.



> > > I have this very very unusual and frsutration problem.
> > > I have an ADO data control on my form.
> > > Now I am trying to connect ado control to an access db.
> > > Now when I connect this ado to any table in this db I have no problem.
> > > But for one simple table when I try to connect, I have this error
> "Syntax
> > > error in FROM clause"
> > > Now this error occurs when I am trying to bind a text box to the field
> of
> > > the table, ie. when I am trying to set the Datafield property of the
> text
> > > box after setting datasource property.

> > > Any clues anybody ???

> > > Abhi



Thu, 28 Oct 2004 05:02:49 GMT  
 Syntax error in FROM clause (ADO)

Quote:

> This is the strangest problem I have ever seen.

It's not that strange, nor that uncommon; there's a very simple (and
obvious if you think about it) explanation.

Quote:
> Thanks for taking the time to reply, but I was able to solve the problem by
> the changing the table name.
> so for example my table name was "Order", now when I have changed it to
> p_Order it works fine
> But if I change p_Order back to Order I have this problem.

"Order" is a reserved word in SQL (as in ORDER BY <field>). You can't use a
reserved word as an object (table, field, etc.) name, so you either have to
escape the name using brackets, e.g.:

  SELECT <field>, <field> FROM [Order]

or, preferably, rename the field, as you have done.

hth

Adam



Thu, 28 Oct 2004 05:10:10 GMT  
 Syntax error in FROM clause (ADO)
Hodo all,

You will also find that if you create a table in Access with the name user
you can add
etc data in access but when you use SQL thru VB you have the same problem.
It is a
reserved key word in SQL and Access 'bypasses' this a bit. So in future use
longer name
and avoid anything that looks like it can be 'system table name' or SQL key
word.

Cheers,
Maartin.


Quote:

> > This is the strangest problem I have ever seen.

> It's not that strange, nor that uncommon; there's a very simple (and
> obvious if you think about it) explanation.

> > Thanks for taking the time to reply, but I was able to solve the problem
by
> > the changing the table name.
> > so for example my table name was "Order", now when I have changed it to
> > p_Order it works fine
> > But if I change p_Order back to Order I have this problem.

> "Order" is a reserved word in SQL (as in ORDER BY <field>). You can't use
a
> reserved word as an object (table, field, etc.) name, so you either have
to
> escape the name using brackets, e.g.:

>   SELECT <field>, <field> FROM [Order]

> or, preferably, rename the field, as you have done.

> hth

> Adam



Sat, 30 Oct 2004 00:58:38 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. ADO "syntax error in FROM clause"

2. Error-2147217900, Syntax error in FROM clause

3. Error 3131 Syntax error in FROM clause - using SQL accessing external ODBC problem

4. Error 3131 Syntax error in FROM clause - using SQL accessing external ODBC problem

5. SQL Syntax error in ORDER BY clause.(-2147217900)

6. Syntax error in FROM clause

7. Help - syntax error in from clause

8. Syntax error in FROM clause??

9. VB Syntax error in FROM Clause

10. SQL Syntax error in FROM Clause...but WHY?

11. FROM clause syntax error with sensible SQL query to Excel database

12. Syntax error in FROM clause

 

 
Powered by phpBB® Forum Software