Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2002
    Posts
    68

    Unanswered: MS Access Errors

    Hi all,

    Question: I am getting an erorr on the dateadd() in a Microsoft Access Database that says: Characters found after end of SQL statement? What does that mean? and how do I fix it?

    Thanks,
    John316

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i hate to sound flippant, but based on the wealth of information you've posted, i would say that the error means that you have some chararacters after the end of your sql statement, and that you would fix it by removing those characters

    show us the complete sql and we might be able to help further

    rudy
    http://rudy.ca/

  3. #3
    Join Date
    Sep 2002
    Posts
    68

    rudy...

    rudy,

    My SQL code is below:


    SELECT report.CLASSCODE, report.CLASSPRIOR, report.DOORCODE, report.CLASSNO, report.DISTRICTNO, Mid([CLASS DATES ]![CLASS SCHEDULED ],5,2) & "/" & Mid([CLASS DATES ]![CLASS SCHEDULED ],7,2) & "/" & Mid([CLASS DATES ]![CLASS SCHEDULED ],3,2) AS [CLASS SCHEDULED ], [CLASS DATES ].[ACTUAL CLASS_DATES ], [CLASS DATES ].[SCHEDULED FINAL_DATES ], [CLASS DATES ].[ACTUAL FINAL_DATES ], [CLASS DATES ].PDD
    FROM report INNER JOIN CLASS DATES ON (report.DOORCODE = [CLASS DATES ].DOORCODE) AND (report.CLASSNO = [CLASS DATES ].CLASSNO) AND (report.COMPYCDE = [CLASS DATES ].COMPYCDE)
    WHERE (((report.CLASSCODE)="CLASS_CODE_01") AND ((Mid([CLASS DATES ]![CLASS SCHEDULED ],5,2) & "/" & Mid([CLASS DATES ]![CLASS SCHEDULED ],7,2) & "/" & Mid([CLASS DATES ]![CLASS SCHEDULED ],3,2))>="01/01/2002" And (Mid([CLASS DATES ]![CLASS SCHEDULED ],5,2) & "/" & Mid([CLASS DATES ]![CLASS SCHEDULED ],7,2) & "/" & Mid([CLASS DATES ]![CLASS SCHEDULED ],3,2))<="06/30/2002"));

    UPDATE CLASS DATES SET Class_Dates.PDD = DateAdd("d",0,CDate([CLASS DATES ]))
    WHERE CLASS DATES .CLASSPRIOR='CL00'

    UPDATE CLASS DATES SET Class_Dates.PDD = DateAdd("d",10,CDate([CLASS DATES ]))
    WHERE CLASS DATES .CLASSPRIOR='CL01'

    UPDATE CLASS DATES SET Class_Dates.PDD = DateAdd("d",20,CDate([CLASS DATES ]))
    WHERE CLASS DATES .CLASSPRIOR='CL02'

    UPDATE CLASS DATES SET Class_Dates.PDD = DateAdd("d",30,CDate([CLASS DATES ]))
    WHERE CLASS DATES .CLASSPRIOR='CL03';

  4. #4
    Join Date
    Aug 2002
    Location
    Cambridge, England
    Posts
    47
    Perhaps you should lose the ';' after the initial SELECT statement

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    john, i believe you can only submit one sql statement at a time

    so anything after the first semicolon causes an error

    by the way, your date strings are the wrong format

    in access they need to be coded with hashes, e.g. #2002-06-30#

    rudy

  6. #6
    Join Date
    Sep 2002
    Posts
    68

    so....

    So how would I fix the problem?

    John316



    Originally posted by r937
    john, i believe you can only submit one sql statement at a time

    so anything after the first semicolon causes an error

    by the way, your date strings are the wrong format

    in access they need to be coded with hashes, e.g. #2002-06-30#

    rudy

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    how would you fix which problem? the date string problem? just code #2002-06-30# instead of "06/30/2002"

    rudy

  8. #8
    Join Date
    Aug 2002
    Location
    Québec, Canada
    Posts
    109
    You'll have to create 5 query, one SELECT and 4 UPDATE, also:


    Look for the little synthax error, do the table named:

    [class date] or
    class_date


    JefB

Posting Permissions

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