Query Help Needed

Results 1 to 3 of 3

Thread: Query Help Needed

  1. #1
    Join Date
    Dec 1969

    Default Query Help Needed

    Hello<BR><BR>I&#039;ve got a query set up but it&#039;s creating an error in the FROM section:<BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80040e14&#039; <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause. <BR><BR>/brumunichess/db/fixtures.asp, line 16 <BR><BR>I&#039;ve managed to narrow it down to the following line....<BR><BR>strQ = "SELECT Players.Name, Players.Grade, Players.[Matches Played], Players.[Matches Won], Players.[Points Scored] FROM Players "<BR>strQ = strQ & "WHERE (((Players.Team)=Division 3)) " &#060;-- Error here<BR>strQ = strQ & "ORDER BY Players.Team, Players.Name; "<BR><BR>It works fine when the WHERE query is taken out but when that&#039;s in it fails! I think it&#039;s because the Division 3 part should be in "" but when I add them in the query obviously fails because it thinks it&#039;s got to the end of the line <BR><BR>Any ideas or am i just being dumb?

  2. #2
    Join Date
    Dec 1969

    Default RE: Query Help Needed

    I&#039;ll be damned if I know what all the parens are for...<BR><BR><BR>Your problem may be the lack of quotes.<BR><BR>Change this: <BR><BR>strQ = strQ & "WHERE (((Players.Team)=Division 3)) " <BR><BR>To this:<BR><BR>strQ = strQ & "WHERE (((Players.Team)=&#039;Division 3&#039;)) " <BR><BR><BR>But I wouldn&#039;t trust me if I were you...<BR><BR><BR>Cheers,<BR>Conrad

  3. #3
    Join Date
    Dec 1969

    Default Spot the obvious mistakes. ...

    ...<BR><BR>In the WHERE part you compare a text field with a string literal. String literals in SQL have to be put inside either two single quotes or two double quotes:<BR><BR>... WHERE Field1 = "Text I want to compare with." ...<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts