Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2009
    Posts
    85

    Unanswered: Query work in GUI, Not as SQL

    Hello, I built the query below in the GUI where it works,

    SQL = "SELECT tblCustomersFinished.Diagnosis, Parse([Diagnosis],1,", ") AS Diagnosis1, Parse([Diagnosis],2,", ") AS Diagnosis2 FROM tblCustomersFinished"

    but I want to run it as a SQL statement in ADO. When I paste this statement in to my code I get error expect: end of statement

    SQL = "SELECT tblCustomersFinished.Diagnosis, Parse([Diagnosis],1,", ") AS Diagnosis1, Parse([Diagnosis],2,", ") AS Diagnosis2 FROM tblCustomersFinished"

    In the first parse statement : 1,", access reads ", and thinks its at the end of my sql statement. Is this possible to fix or make work, any comments or insight is appreciated, Thanks

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Change the double quotes inside the string to single quotes.
    Paul

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    when thsi sort of thing happens examine the SQL you are sending to the SQL engine
    either through setting a breakpoint
    OR
    msgbox ("JET Crapped out on my SQL which was:" & vbcrlf & SQL)


    ...its amazing how many times what you think you sent to the SQL engine isn't what actually went
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Apr 2009
    Posts
    85
    Thank you both, I would be lost with out all this help and commentary

Posting Permissions

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