|
| |
|
|
Felix
Posts: 112 Joined: 3/23/2002 From: United Kingdom Status: offline
|
Help Spooky - Exporting ASP to Excel - 11/26/2007 5:26:57
Could I please resurrect this post and ask Spooky for some urgent help? - http://www.frontpagewebmaster.com/m-197620/key-excel/tm.htm#282980 I am passing variables over namely 'ccpPeriod' and 'fullcode'. The ccpPeriod could be '2007-8' and fullcode could be 01-810-1020-10700, 01-810-1036-10700, 01-810-1123-10700. I am using an IN query which looks like this : SQL = "SELECT FDS.POLines.ccpPeriod, FDS.POLines.scdCode, FDS.POLines.bgdCode + '-' + FDS.POLines.scdCode AS FullCode, SUM(FDS.POLines.polLinePrice) AS GrandTotal, FDS.BudgetCodes.bgdDesc, FDS.SubCodes.scdDesc, FDS.BudgetCodePeriodSubCode.bpsLimit FROM FDS.POLines INNER JOIN FDS.POHeader ON FDS.POLines.ponOrderNo = FDS.POHeader.ponOrderNo INNER JOIN FDS.BudgetCodes ON FDS.POLines.bgdCode = FDS.BudgetCodes.bgdCode INNER JOIN FDS.SubCodes ON FDS.POLines.scdCode = FDS.SubCodes.scdCode INNER JOIN FDS.BudgetCodePeriodSubCode ON FDS.POLines.ccpPeriod = FDS.BudgetCodePeriodSubCode.ccpPeriod AND FDS.POLines.bgdCode = FDS.BudgetCodePeriodSubCode.bgdCode AND FDS.POLines.scdCode = FDS.BudgetCodePeriodSubCode.scdCode WHERE (NOT (FDS.POHeader.pohStatus = 'Cancelled')) GROUP BY FDS.POLines.ccpPeriod, FDS.POLines.bgdCode + '-' + FDS.POLines.scdCode, FDS.POLines.bgdCode, FDS.POLines.scdCode, FDS.BudgetCodes.bgdDesc, FDS.SubCodes.scdDesc, FDS.BudgetCodePeriodSubCode.bpsLimit HAVING (FDS.POLines.ccpPeriod IN ('"&ccpPeriod&"')) AND ((FDS.POLines.bgdCode + '-' + FDS.POLines.scdCode) IN ('"&FullCode&"')) ORDER BY FDS.POLines.bgdCode + '-' + FDS.POLines.scdCode" The problem I have though is that the following error is displayed : Microsoft OLE DB Provider for SQL Server (0x80040E14) Line 1: Incorrect syntax near '2007'. I am assuming that the problem is with the '-' characters because if I write them out into the query i.e. '2008-8' then the process works and I can open the data up into excel. How can I change the SQL query to accept the '-' characters in the data? Many thanks.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|