Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Help filtering records

Posted on 2003-11-25
4
283 Views
Last Modified: 2012-06-21
I'm trying to modify a calendar application I found.  I've got a master calendar that displays events taking place in all the rooms in the database.  Now I'm trying to write individual calendar views for each room.    

I've got it working so the current month's events show up in the proper room, but if I try to advance a month, I get a blank calendar.  I'm not sure if the problem lies in my select statement  or the way I've got the link set up to advance to the next month.

Select statement:

rsEventsDay.Source = "SELECT *  FROM EVENTS, TYPES WHERE EVE_APPROVED=1 AND EVE_TYPE = " + Replace(rsEventsDay__MMColParam, "'", "''") + " AND EVE_TYPE = TYPE_ID  ORDER BY EVE_DATED"

Here's the code  I was trying to advance to the next month:

<a fref="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>

Can someone point me in the right direction?  Thanks!
0
Comment
Question by:mtarby
  • 2
4 Comments
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9819681
<a fref="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>

should be..

<a href="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>

Anyway.. i dont think that should be the error.. post the rest of the code as the code above seems to be correct..

Cheers!!
0
 

Author Comment

by:mtarby
ID: 9819871
Sorry - you were right, that wasn't causing the error.  Here's more of the code:

<%
Dim rsEventsDay__MMColParam
rsEventsDay__MMColParam = "0"
if (Request.QueryString("iType") <> "") then rsEventsDay__MMColParam = Request.QueryString("iType")
%>
<%
set rsEventsDay = Server.CreateObject("ADODB.Recordset")
rsEventsDay.ActiveConnection = MM_connDUcalendar_STRING
rsEventsDay.Source = "SELECT *  FROM EVENTS, TYPES WHERE EVE_APPROVED=1 AND EVE_TYPE = " + Replace(rsEventsDay__MMColParam, "'", "''") + " AND EVE_TYPE = TYPE_ID  ORDER BY EVE_DATED"
rsEventsDay.CursorType = 0
rsEventsDay.CursorLocation = 2
rsEventsDay.LockType = 3
rsEventsDay.Open()
rsEventsDay_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsEventsDay_numRows = rsEventsDay_numRows + Repeat1__numRows
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>      
function DoTrimProperly(str, nNamedFormat, properly, pointed, points)
  dim strRet
  strRet = Server.HTMLEncode(str)
  strRet = replace(strRet, vbcrlf,"")
  strRet = replace(strRet, vbtab,"")
  If (LEN(strRet) > nNamedFormat) Then
    strRet = LEFT(strRet, nNamedFormat)                  
    If (properly = 1) Then                              
      Dim TempArray                                                
      TempArray = split(strRet, " ")      
      Dim n
      strRet = ""
      for n = 0 to Ubound(TempArray) - 1
        strRet = strRet & " " & TempArray(n)
      next
    End If
    If (pointed = 1) Then
      strRet = strRet & points
    End If
  End If
  DoTrimProperly = strRet
End Function
</SCRIPT>
<%
If Request("iDate") <> "" Then
   iDate = DateValue(Request("iDate"))
Else
   iDate = date
End if

CurrentMonth = Month(iDate)
CurrentMonthName = MonthName(CurrentMonth)
CurrentYear = Year(iDate)

FirstDayDate = DateSerial(CurrentYear, CurrentMonth, 1)
FirstDay = WeekDay(FirstDayDate, 0)
CurrentDay = FirstDayDate

%>

And where I'm trying to put the link:

 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr align="center" valign="middle">
<td align = "left" class="bgMonthListing">&laquo; <a href="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",-1, iDate))%>"><%= UCASE(Left(MonthName(Month(DateAdd("m", -1, CurrentDay))),3)) %></a></td>
<td class="bgMonthListing"><%= UCASE(rsEventsDay.Fields.Item("TYPE_NAME").Value)%> - <%= UCASE(CurrentMonthName & " " & CurrentYear) %></td>
<td align = "right" class="bgMonthListing"><a href="type.asp?iDate=<%= Server.URLEncode(DateAdd("m",1,iDate))%>"><%= (Left(MonthName(Month(DateAdd("m", 1, CurrentDay))),3)) %></a>
&raquo;</td>
</tr>
</table>

Thanks!



0
 

Accepted Solution

by:
jenn5175 earned 250 total points
ID: 9852951
Looks like you're not sending iType in your querystring so iType=0 and you probably don't have anything in the db for a iType=0
0
 

Author Comment

by:mtarby
ID: 9853249
Thanks!  I knew I was missing something obvious - its working great now.  
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to hide hopscotch tour popup page reload? 2 94
Why Bundles is not working on certain files - ASP MVC 3 59
ASP CDO - Limiting Connections 3 59
Index on a Table 6 25
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question