Subject: ASP Page Error **NEED HELP**
Posted By: APD189 Post Date: 1/10/2006 6:25:40 PM
I am having a problem with this ASP page.  Could anyone help me out with this.

I get an error message on line 300.  Below is the page.

<!--#include file="db.asp"-->
<%
    DBOpen
    
    Synchronize
    
    numDay = StringToLong(ReadStr("Day"))
    numMonth = StringToLong(ReadStr("Month"))
    numYear = StringToLong(ReadStr("Year"))
    ParishID = StringToLong(ReadStr("ParishID"))
    
    If Not numMonth>0 Then
        numMonth = Month(Now())
    End If
    If Not numYear>0 Then
        numYear = Year(Now())
    End If                      

    intFontSize = 3
    If numDay>0 Then
        If IsDate(numMonth & "/" & numDay & "/" & numYear) Then
            intFontSize = 1
            strDate = FormatDateTime(numMonth & "/" & numDay & "/" & numYear,1)
        End If
    End If

    If numMonth>1 Then
        numPrevMonth = numMonth - 1
        numPrevYear = numYear
    Else
        numPrevMonth = 12
        numPrevYear = numYear - 1
    End If
    If numMonth<12 Then
        numNextMonth = numMonth + 1
        numNextYear = numYear
    Else
        numNextMonth = 1
        numNextYear = numYear + 1
    End If
    
    If 0 Then
%>

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Parish Calendar</title>
</head>

<body><%
    End If
%>
<!--#include file="header.asp"--->
<form method=post action=calendar.asp name=frmCalendar>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" bgcolor="#0033CC">&nbsp;<a
      href="calendar.asp?Month=<%=numPrevMonth%>&amp;Year=<%=numPrevYear%>&amp;Day=0&amp;ParishID=<%=ParishID%>"><font
      face="Arial" size="2" color="#ffffff">&lt;&lt; Previous Month</font></a><br>
    </td>
    <td align="center" bgcolor="#0033CC"><font face="Arial" size="4"
      color="#ffffff"><b><%=MonthName(numMonth)%>, <%=numYear%></b></font></td>
    <td align="right" bgcolor="#0033CC"><a
      href="calendar.asp?Month=<%=numNextMonth%>&amp;Year=<%=numNextYear%>&amp;Day=0&amp;ParishID=<%=ParishID%>"><font
      face="Arial" size="2" color="#ffffff">Next Month &gt;&gt;</font></a>&nbsp;<br>
    </td>
  </tr>
</table>
<%
    If ParishID>0 Then
        SQL = "SELECT DISTINCT EventDate,EventType FROM Events"
        SQL = SQL & " WHERE EventDate>=#" & numMonth & "/1/" & numYear & "#"
        SQL = SQL & " AND EventDate<#" & numNextMonth & "/1/" & numNextYear & "#"
        SQL = SQL & " AND (ParishID=" & ParishID & " OR EXISTS(SELECT * FROM EventParishes WHERE Events.EventID=EventParishes.EventID AND EventParishes.ParishID=" & ParishID & "))"
        SQL = SQL & " ORDER BY EventDate,EventType"
    Else
        SQL = "SELECT DISTINCT EventDate,EventType FROM Events"
        SQL = SQL & " WHERE EventDate>=#" & numMonth & "/1/" & numYear & "#"
        SQL = SQL & " AND EventDate<#" & numNextMonth & "/1/" & numNextYear & "#"
        SQL = SQL & " AND List=True"
        SQL = SQL & " ORDER BY EventDate,EventType"
    End If
    rs.Open SQL, db, adOpenStatic, adLockReadOnly
%>
<table border="2" bordercolor="#000000" width="100%" cellpadding="0"
cellspacing="0">
  <tr>
    <td>
      <table border="1" width="100%">
        <tr>
          <%
        For I = 1 to 7
          %>
          <th bgcolor="#000000" align="center"><font face="Arial" size="1"
            color="#ffffff"><b><%=WeekDayName(I)%></font></b>
            <%
        Next ' I
            %>      
        </tr>
                      <%
        Offset = WeekDay(CDate(numMonth & "/1/" & numYear)) - 1
        For I = 1 to 6
            numDayShow = ((I-1) * 7) + 1 - Offset
            If I < 6 OR IsDate(numMonth & "/" & numDayShow & "/" & numYear) Then
                      %>
        <tr>
                        <%
                For J = 1 to 7
                    numDayShow = ((I-1) * 7) + J - Offset
                        %>
          <td align="right" width="10%" valign="top"><font face="Arial"
            size="<%=intFontSize%>"><%
                    If numDayShow>0 Then
                        If IsDate(numMonth & "/" & numDayShow & "/" & numYear) Then
                            dtShow = CDate(numMonth & "/" & numDayShow & "/" & numYear)
                            If numDay = numDayShow Then
                                Response.Write "<b>" & numDayShow & "</b>"
                            Else
                          %><a
            href="calendar.asp?Month=<%=numMonth%>&amp;Year=<%=numYear%>&amp;Day=<%=numDayShow%>&amp;ParishID=<%=ParishID%>"><%=numDayShow%></a><%
                            End If
            %><br>
            <font face="Arial" size="1"><%
                            bDone = False
                            bShown = False
                            While Not rs.EOF AND Not bDone
                                If DateDiff("d",dtShow,rs("EventDate"))=0 Then
                                    strShow = rs("EventType")
                                    If Len(strShow)>16 Then
                                        strShow = Left(strShow,15) & ".."
                                    End If
                                    strShow = Replace (strShow," ","&nbsp;")
                                    Response.Write strShow & "<br>"
                                    bShown = True
                                    rs.MoveNext
                                Else
                                    bDone = True
                                End If
                            Wend
                            If Not bShown Then
            %><br>
            <%
                            End If
            %></font><%
                        End If
                      End If            
                          %></font></td>
                        <%
                Next ' J          
                        %>
        </tr>
                      <%
            End If
        Next ' I
                      %>
      </table>
    </td>
  </tr>
</table>
<%
    rs.Close
%>
<table width="100%">
  <tr>
    <%
            For I = 1 to 12
    %>
    <td><font face="Arial" size="1"><%
                If I = numMonth Then
                    Response.Write "<b>" & MonthName(I) & "</b>"
                Else
      %>
      <a
      href="calendar.asp?Month=<%=I%>&amp;Year=<%=numYear%>&amp;Day=0&amp;ParishID=<%=ParishID%>"><%=MonthName(I)%></a>
      <%
                End If
      %>
      </font></td>
    <%
                If I = 6 Then
                    Response.Write "</tr><tr>"
                End If
            Next ' I
    %>
  </tr>
</table>
<%
    If intFontSize = 1 Then
%>
<br>
<font size="3" face="Arial"><b><%=strDate%></b></font><br>
<%    
    If ParishID>0 Then
        SQL = "SELECT * FROM Events"
        SQL = SQL & " WHERE EventDate=#" & numMonth & "/" & numDay & "/" & numYear & "#"
        SQL = SQL & " AND (ParishID=" & ParishID & " OR EXISTS(SELECT * FROM EventParishes WHERE Events.EventID=EventParishes.EventID AND EventParishes.ParishID=" & ParishID & "))"
        SQL = SQL & " ORDER BY EventDate,EventType"
    Else
        SQL = "SELECT * FROM Events"
        SQL = SQL & " WHERE EventDate=#" & numMonth & "/" & numDay & "/" & numYear & "#"
        SQL = SQL & " AND List=True"
        SQL = SQL & " ORDER BY EventDate,EventType"
    End If
        rs.Open SQL, db, adOpenStatic, adLockReadOnly
        If Not rs.EOF Then
%>
<table cellspacing="10" cellpadding="0" border="0">
  <%
            While Not rs.EOF
                bAllDay = (rs("TimeStart") = 0) AND (rs("TimeEnd") = 0)
                If Not bAllDay Then
                    strStart = FormatDateTime(rs("TimeStart"),3)
                    strStart = Left(strStart,InStrRev(strStart,":")-1) & LCase(Right(strStart,2))
                    strEnd = FormatDateTime(rs("TimeEnd"),3)
                    strEnd = Left(strEnd,InStrRev(strEnd,":")-1) & LCase(Right(strEnd,2))
                End If
      %>  
  <tr>
    <%
                If bAllDay Then
    %>    
    <td valign="top" nowrap><font size="2" face="Arial"><b>ALL DAY</b></font></td>
      <%
                Else
    %>    
    <td valign="top" nowrap><font size="2" face="Arial"><b><%=strStart%></b><br>
      to&nbsp;<b><%=strEnd%></b></font></td>
      <%
                  End If
      %>
    <td valign="top"><%
                strLocation = rs("Location")
                If Len(strLocation)>0 Then
      %><font size="2" face="Arial"><%=rs("EventType")%> for <b><%=rs("Parish")%></b><br>
      at <b><%=strLocation%></b><br>
      <%
                Else
      %><font size="2" face="Arial"><%=rs("EventType")%>                at <b><%=rs("Parish")%></b><br>
      <%
                End If
        %>
      <font size="2"><%=rs("SpeakerName")%>                             
      speaking on <i>&quot;<%=rs("TopicTitle")%>&quot;</i></font></font></font></td>
    <%
                If Authorized AND Admin Then
            %>  
    <td align="right" valign="top"><font size="2" face="Arial"><a
      href="rep-form.asp?Submit=Edit&amp;EventID=<%=rs("EventID")%>"><b>EDIT</b></a></font></td>
    <%
    %>  
  </tr>
  <%
                End If
                strNotes = rs("Notes")
                  If Len(strNotes)>0 Then
  %>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><font size="2" face="Arial"><i><%=strNotes%></i></font></td>
  </tr>
      <%
                  End If
                rs.MoveNext
            Wend
      %>
</table>
<%
        End If
        rs.Close
    End If
 %>
<br>
<br>
<br>
<%
    If Authorized Then
%><font size="1" face="Arial">Hi <%=Name%>, <a href="../cursillo/rep-form.asp">Add
Events Here</a></font><%
    Else
%>
 <font size="1" face="Arial">Are you a Calendar Admin? <a href="login.asp">Add
 Events Here</a></font>
<%    End If
%>
</form>
<!--#include file="footer.asp"--->
<%
    DBClose
    
    If 0 Then    
%>

</html>
<%    
    End If
%>

Line 300 is the last End If and I can't seem to figure it out.

Thanks APD189


Go to topic 38479

Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390
Return to index page 389