Solved

Help filtering records

Posted on 2003-11-25
4
280 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

864 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now