Re: VB MS Access Syntax error in FROM clause Error

From: Val Mazur (group51a_at_hotmail.com)
Date: 05/27/04


Date: Wed, 26 May 2004 23:30:49 -0400

Hi,

Usually this error generated in a case when table name or some of the fields
in a query are reserved words. Could be that Project is a reserved word or
some of the fields. In this case you need to wrap these names into square
brackets, like

SELECT [name], ... FROM [Project] ....

-- 
Val Mazur
Microsoft MVP
"VB MS Access Syntax error in FROM clause" <carl244541@yahoo.com> wrote in 
message news:513DB8B4-54DB-432B-9F98-A96054DECB36@microsoft.com...
>I have a program that is recieving the following error "Syntax error in 
>FROM clause." and I am not sure why anyone have any ideas, here is the 
>code:
>
>            strSQL = "SELECT * FROM Project Where ProjectID=" & 
> Val(PrjID.Text)
>            Set rNew = New ADODB.Recordset
>            rNew.CursorLocation = adUseClient
>            Call OpenAccessConnection(cnn, gDBNameandPath)
>            rNew.Open strSQL, cnn, adOpenKeyset, adLockBatchOptimistic, 
> adCmdTable
>
> it occurs on the open, any help would be appreciated.
>
> carl 


Relevant Pages

  • Re: problem to SELECT using Microsoft Access (posted again, because of posting error)
    ... I tested that query. ... I get an error "syntax error in from clause" which is ... becuase Table is a reserved word ...
    (borland.public.delphi.database.ado)
  • Re: probably not as complex as Im thinking...
    ... No, sorry, I get a syntax error in Group By clause here, and I tried not ... >> OK, I have 4 queries, the SQL view of which I have below, with brief ... Please understand that I use the Query Design Grid to make ...
    (microsoft.public.access.queries)
  • Re: GROUP BY clause not working
    ... using PEAR and I'm getting DB Error: Syntax Error when using the GROUP ... you cannot use columns in a query containing a GROUP BY ... clause, unless they are part of the clause or an aggregate function. ... SELECT LocationID FROM HardwareInstallationsSummary WHERE LocationID = ...
    (comp.lang.php)
  • Re: GROUP BY clause not working
    ... using PEAR and I'm getting DB Error: Syntax Error when using the GROUP BY clause. ... Here's my query: ... SELECT * FROM HardwareInstallationsSummary WHERE LocationID = $loc_ID GROUP BY EquipmentTypeID ...
    (comp.lang.php)
  • Re: Max function query
    ... You use a subquery as a "calculated field" to get the Payer and Payee values ... If you don't want to use subqueries within the query, ... FROM YourTable INNER JOIN qryMaxPayer ON ... Problem names and reserved words in Access ...
    (microsoft.public.access.queries)