Solved

Help filtering records

Posted on 2003-11-25
4
286 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
[X]
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
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Select only the top record in a left join 13 51
Writing comments on <p></P> or paragraph 2 23
Html Table looping 4 43
Table doesn't show the lines! 3 38
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 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