Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help filtering records

Posted on 2003-11-25
4
Medium Priority
?
290 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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

886 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