Results 1 to 3 of 3

Thread: [RESOLVED] VBScript error

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    6

    Resolved [RESOLVED] VBScript error

    I have the following SQL statement, for which I am receiving this error: (VB doesn't seem to like my # signs, but I read that date fields require this?)

    Microsoft VBScript compilation error '800a0401'
    Expected end of statement
    /feed_chart.asp, line 15

    SQL = "SELECT WkOf, Avg, AvgFut FROM FeedStocks_Query where (Commodity ='" & Replace(Session("SesCommodity"), "'", "''") & "') AND (Location ='" & Replace(Session("SesLocation"), "'", "''") & "') AND WkOf >= #" & Replace(Session("SesFromDate"), "'", "''") & "') & "# AND WkOf <= #" & Replace(Session("SesToDate"), "'", "''") & "') & "# GROUP BY Commodity;"

    The latter part of the SQL was more or less copied from another ASP that works (orig sql: ...where (Commodity ='" & Replace(Request.Form("Feed_commodity"), "'", "''") & "') AND (Location ='" & Replace(Request.Form("Feed_location"), "'", "''") & "') AND WkOf >= #" & Feed_Date_From & "# AND WkOf <= #" & Feed_Date_To & "# GROUP BY...).

    I'm sure it's just a minor syntax error, but it's giving me grief. Any help you could offer would be great! Tx!

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: VBScript error

    You've added a few random bits near the end.. just remove the underlined parts:
    VB Code:
    1. Replace(Session("SesFromDate"), "'", "''") & [u]"') & [/u]"# AND WkOf <= #" & Replace(Session("SesToDate"), "'", "''") [u]& "')[/u] & "# GROUP BY Commodity;"

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    6

    Re: VBScript error

    Si_the_geek, you rock! Thanks again!

Posting Permissions

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



Click Here to Expand Forum to Full Width