SQL Syntax error in FROM Clause...but WHY? 
Author Message
 SQL Syntax error in FROM Clause...but WHY?

Any help appreciated.

I have this code in a test program with two ado data controls.

ContactData.RecordSource = "SELECT *  FROM [contacts]  WHERE CustID=" _
    & CustomerData.Recordset("CustID")

Why am I getting a syntax error?



Wed, 11 Jul 2001 03:00:00 GMT  
 SQL Syntax error in FROM Clause...but WHY?
Richard,

The code looks fine to me. Syntax error you say, is this at compile time, or
are you getting a run time error, and if so what is the exact error?

--
HTH
VB-Joker

PLEASE post ALL replies to newsgroup!


Quote:
>Any help appreciated.

>I have this code in a test program with two ado data controls.

>ContactData.RecordSource = "SELECT *  FROM [contacts]  WHERE CustID=" _
>    & CustomerData.Recordset("CustID")

>Why am I getting a syntax error?



Thu, 12 Jul 2001 03:00:00 GMT  
 SQL Syntax error in FROM Clause...but WHY?
Put spaces around "="

ContactData.RecordSource = "SELECT *  FROM [contacts]  WHERE CustID    =    " _
    & CustomerData.Recordset("CustID")



Thu, 12 Jul 2001 03:00:00 GMT  
 SQL Syntax error in FROM Clause...but WHY?
Richard,

If CustID is a numeric value it should work.  If CustID is an alphanumeric
you will need to surround it in single quotes.  At what point are you
getting a syntax error, and what is the error?

Regards,

Peter

Quote:

>Any help appreciated.

>I have this code in a test program with two ado data controls.

>ContactData.RecordSource = "SELECT *  FROM [contacts]  WHERE CustID=" _
>    & CustomerData.Recordset("CustID")

>Why am I getting a syntax error?



Thu, 12 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

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

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

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

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

5. SQL statement - error in FROM clause, WHY ?

6. Error-2147217900, Syntax error in FROM clause

7. SQL Syntax \like clause

8. HELP / HELP / syntax SQL / 'LIKE' clause

9. Help!!! for SQL syntax: LIKE clause

10. hELP!!! FOR SQL SYNTAX: LIKE CLAUSE

11. Syntax error in FROM clause

12. Help - syntax error in from clause

 

 
Powered by phpBB® Forum Software