I'm having problems with a report opening in Excel from ASP. The report starts to pull, but then the excel window closes immediately.. here's the code:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #include file="dbopen.inc" -->
<!-- #include file="ADOVBS.inc" -->
<%
ops = trim(request("ops"))
dim arrOPS
arrOPS = split(ops,",")
excelSQL = "SELECT " & arrOPS(1)
%>
<link rel="stylesheet" type="text/css" href="jstyle.css" />
<%'Response.ContentType = "application/vnd.ms-excel"%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><font class="ti">Causecode</font></td>
<% for x = 2 to Ubound(arrOPS) %>
<% if arrOPS(x) = "ccdescription" then %>
<% excelSQL = excelSQL & ", ccdescription" %>
<td><font class="ti">Cause Code Description</font></td>
<% end if %>
<% if arrOPS(x) = "acctnum" then %>
<% excelSQL = excelSQL & ", acctnum" %>
<td><font class="ti">Account Number</font></td>
<% end if %>
<% if arrOPS(x) = "acctname" then %>
<% excelSQL = excelSQL & ", acctname" %>
<td><font class="ti">Account Name</font></td>
<% end if %>
<% if arrOPS(x) = "entrydate" then %>
<% excelSQL = excelSQL & ", entrydate" %>
<td><font class="ti">Entry Date</font></td>
<% end if %>
<% if arrOPS(x) = "entrytime" then %>
<% excelSQL = excelSQL & ", entrytime" %>
<td><font class="ti">Entry Time</font></td>
<% end if %>
<% if arrOPS(x) = "contactname" then %>
<% excelSQL = excelSQL & ", contactname" %>
<td><font class="ti">Contact Name</font></td>
<% end if %>
<% if arrOPS(x) = "contactphone" then %>
<% excelSQL = excelSQL & ", contactphone" %>
<td><font class="ti">Contact Phone</font></td>
<% end if %>
<% if arrOPS(x) = "severity" then %>
<% excelSQL = excelSQL & ", severity" %>
<td><font class="ti">Severity Level</font></td>
<% end if %>
<% if arrOPS(x) = "product" then %>
<% excelSQL = excelSQL & ", product" %>
<td><font class="ti">Product Type</font></td>
<% end if %>
<% if arrOPS(x) = "opid" then %>
<% excelSQL = excelSQL & ", opid" %>
<td><font class="ti">Operator ID</font></td>
<% end if %>
<% if arrOPS(x) = "comments" then %>
<% excelSQL = excelSQL & ", comments" %>
<td><font class="ti">Comments</font></td>
<% end if %>
<% if arrOPS(x) = "iic" then %>
<% excelSQL = excelSQL & ", iic" %>
<td><font class="ti">IIC</font></td>
<% end if %>
<% if arrOPS(x) = "iicdescription" then %>
<% excelSQL = excelSQL & ", iicdescription" %>
<td><font class="ti">IIC Description</font></td>
<% end if %>
<% next %>
</tr>
</table>
<%
excelSQL = excelSQL & " FROM tblri21 " & session("whereSQLfinal")
set objRS = rtl.execute(excelSQL)
response.Write(objRS("causecode"))
%>
<table>
<% if not objRS.eof then %>
<% while not objRS.eof %>
<tr>
<% for g = 1 to ubound(arrOPS) %>
<td><%=objRS(arrOPS(g))%></td>
<% next %>
</tr>
<% objRS.movenext %>
<% wend %>
<% end if %>
</table>
<% objRS.close %>
<% set objRS = nothing %>
<!-- #include file="dbclose.inc" -->