|
-
Jun 23rd, 2006, 09:55 AM
#1
Thread Starter
New Member
[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!
-
Jun 23rd, 2006, 10:21 AM
#2
Re: VBScript error
You've added a few random bits near the end.. just remove the underlined parts:
VB Code:
Replace(Session("SesFromDate"), "'", "''") & [u]"') & [/u]"# AND WkOf <= #" & Replace(Session("SesToDate"), "'", "''") [u]& "')[/u] & "# GROUP BY Commodity;"
-
Jun 23rd, 2006, 11:00 AM
#3
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|