Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event Calendar function: only displaying events for today

Status
Not open for further replies.

Diggum1

Programmer
Oct 14, 2004
67
US
I am modifying an Events Calendar for a website. Unfortunately, I am an ASP novice. Below is the code for the Calendar Admin function, but it is only displaying events for the current day. I'd like it to pull ALL events from the Access DB. Any ideas?

Thanks so much, Rick



----------------------------------------------------------

<!--#include file="config.asp" -->
<%
if not Session("DiaryAdmin") then
Response.Redirect("login.asp?go=diary_manager.asp?" & Request.QueryString())
End If

function dNum(n)
if n >= 10 then
dNum = cstr(n)
Else
dNum = "0" & cstr(n)
End If
End Function

'SQL Formatted Date
Function SQLDate(dt)
SQLDate = cdbl(dt)
End Function

Response.ExpiresAbsolute = dateadd("d", -5, date())
Response.Expires = -10
set objCon= Server.CreateObject("ADODB.Connection")
set objRs = Server.CreateObject("ADODB.Recordset")

objCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\websites\
view_date = Request.QueryString("view_date")
if view_date = "" then view_date = clng(date())
%>
<HTML>
<HEAD>
<meta name=vs_targetSchema content="<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<META NAME="ROBOTS" CONTENT="INDEX,NOFOLLOW">
<script language="javascript">

function openWin(win, w, h) {
var le = (screen.availWidth - w) /2;
var he = (screen.availHeight -h) /2;
window.open(win,null,"height="+h+",width="+w+",status=no,toolbar=no,scrollbars=no,menubar=no,location=no,left="+le+", top="+he,false);
//location.reload();
}

</script>
<title>Diary Manager</title>
<link rel="stylesheet" type="text/css" href="diary.css">
</head>
<body>
<%
SQL = "SELECT id , dte, diary.text_field, Diary_Categorys.Category, Diary_Categorys.Colour, Diary_Categorys.BgColour" & _
" FROM Diary_Categorys RIGHT JOIN diary ON Diary_Categorys.Cat_ID = diary.Category where dte = " & view_date
objRs.Open SQL, objCon
%>
<div class="Heading2">Calendar Manager</div>
<div align="right"><a href="javascript:eek:penWin('diary_EditE.asp?mode=Add&view_date=<%=SQLDate(view_date)%>&cat=all', 400, 400)">Add New Event</a> | <a href="diary_category.asp">Edit Categories</a> | <a href="default.asp?view_Date=<%=Request.QueryString("View_Date")%>">Back</a></div>
<div class=heading3><%= day(view_date) & " " & monthname(month(view_date)) & " " & year(view_date) %></div>

<table border="0" cellpadding="4" cellspacing="3" align=center>
<tr valign="top">
<td class="heading3">Choose an Event to Edit</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="1" class="maintble" width="350">
<tr>
<td class=titlebar>Event</td>
<td class=titlebar>Date & Time</td>
</tr>
<%
if objRs.EOF or objRs.BOF then
Response.Write "<tr><td colspan=2 class=Item>No events found for today</td></tr></table>"
Else
do until objRs.EOF
d = cdate(objRs("dte"))
Response.Write "<tr>"
Response.Write "<td class=item><a href=""javascript:eek:penWin('diary_EditE.asp?view_date=" & view_date & "&mode=edit&id=" & objRs("id") & "', 400, 400)"">" & objRs("text_field") & "</a></td>"
Response.Write "<td class=Item>" & day(d) & " " & monthname(month(d)) & " " & year(d) & "</td>" & vbcrlf
Response.Write "</tr>"
objRs.MoveNext
loop
Response.Write "</table>"
End If
%>
</td>
</tr>
</table>
<!-- This footer is required by the license terms, removing it is illegal! --><br />
<div align="center" class="normal"></div>

</BODY>
</HTML>
<%
on error resume next
objRs.Close
objCon.Close
set objRs= nothing
set objCon = nothing
%>
 
Looks like this is your problem:

SQL = "SELECT id , dte, diary.text_field, Diary_Categorys.Category, Diary_Categorys.Colour, Diary_Categorys.BgColour" & _
" FROM Diary_Categorys RIGHT JOIN diary ON Diary_Categorys.Cat_ID = diary.Category where dte = " & view_date

Try changing this to:

SQL = "SELECT id , dte, diary.text_field, Diary_Categorys.Category, Diary_Categorys.Colour, Diary_Categorys.BgColour" & _
" FROM Diary_Categorys RIGHT JOIN diary ON Diary_Categorys.Cat_ID = diary.Category
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top