Click to See Complete Forum and Search --> : Multiple Problems with form output.


Mikey
07-23-2003, 07:59 AM
I have a form in which the user selects a starting date and ending date for a query of a access database. The output is to be displayed in excel format... However, when the form is submitted a window pops up asking for user for a Network Password. After hitting cancel because the user has no user name or password, the query fails because the starting and ending date variables are empty.

Can you tell me where these problems originate and how to correct them.

Parts of code - The Form:

...
<td>
<input type="text" name="varStart" size=10><small><a href="javascript:showCal('Calendar3')">
&nbsp;Start Date</a></small>&nbsp;
<input type="text" name="varEnd" size=10><small><a href="javascript:showCal('Calendar4')">
&nbsp;End Date</a> </small>&nbsp;
<input type=submit value="Submit Query" id=submit2 name=submit2>&nbsp;
Excel<input id="checkbox3" type="checkbox" name="varCB3">&nbsp;
Chart<input id="checkbox4" type="checkbox" name="varCB4"></td></tr></form></table>


The ASP:

<%@ Language=VBScript %>
<%
Response.Buffer = True
varStart = Request.Form ("varStart")
varEnd = Request.Form ("varEnd")
varCB1 = Request.Form ("varCB1")
varCB2 = Request.Form ("varCB2")
varCB3 = Request.Form ("varCB3")
varCB4 = Request.Form ("varCB4")
strURL1 = "ERR1.asp"
strURL2 = "ERR4.asp"
If varEnd = "" Then
varEnd = varStart
End If
If varStart = "" And varEnd = "" Then
Response.Redirect strURL1
Else If varEnd < varStart OR varStart = "" Then
Response.Redirect strURL2
End If
End If
day1 = (Day(varStart))
day2 = (Day(varEnd))
days = (day2 - day1) + 1
If varCB3 = "on" Then
Call Excel()
ElseIF varCB4 = "on" Then
Call Chart()
Else
Call Table()
...

<%
Public Sub Excel()
Response.ContentType = "application/vnd.ms-excel"
If varCB1 <> "on" and varCB2 <> "on" then
varCB1 = "on"
varCB2 = "on"
End If
Set objConn = Server.CreateObject ("ADODB.Connection")
strConnection = "DSN=TSMSCHWRSTP;Database=TSMSCHWRSTP"
strConnection = strConnection & "UID=sa;PWD=;"
objConn.Open strConnection
strQuery = "SELECT * FROM TSMSCHWRSTP "
strQuery = strQuery & "WHERE DateofDay BETWEEN "
strQuery = strQuery & "#" & varStart & "# And #" & varEnd & "# "
strQuery = strQuery & "ORDER BY DateofDay, TimeofDay ASC "
Set objRS = objConn.Execute(strQuery)

...


Need more... I got it

Thanks

Mikey
07-23-2003, 08:26 AM
Thanks Dave, you made me look a little closer to the problem.

The popup window is a Windows' Enter Network Password.

Please enter your authentication information.
Resourse is http: ... the asp the form is calling.

I don't think it's for the database (I could be wrong), but when I select the output in Table or Graph format I don't have a problem. Just when the output is in excel.

Mikey
07-23-2003, 08:46 AM
I'm thinking in that direction also, but where is that controlled? I've been in the IIS but I have no idea what to change.

Mikey
07-24-2003, 06:50 AM
Seems like nobody knows what to do.

Funny