I am trying to create a table which displays events for the current day and
the next 6 days. I am using a query to get all the records out of the db
which have start dates and/or end dates during the next 6 days.

The problem that I have encountered is that I cannot seem to get the proper
events to display under the correct date inside the table I am constructing.
I believe the problem is inside the guard I am using inside the first CFIF
in the code below. I usually get events that have a startdate on the
celldate to display correctly but for at least one record I get a event that
takes place at a later date displaying under the wrong date.

It seems to me that the functions for DateCompare, DateDiff, and the regular
GTE
expression aren't working right with the dates that I have. Could this be an
Access 2000 issue? Perhaps I should try to group the query results using the
SQL GROUP BY instead of using the loop belew?

Boy, this is kinda hard to explain. . .Anyway if you need some examples of
how my output is going wrong let me know. Any help you could give would be
greatly appreciated! :)

Thanks in advance,

--Kurt Wiersma

Here is the code:

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4">

<CFLOOP FROM="0" TO="6" INDEX="i">
<TR BGCOLOR="black"><CFSET celldate = DateAdd("D", i, querystartdate)>
<TD COLSPAN="3"><FONT COLOR="white"><CFOUTPUT><B>#DateFormat
(celldate, "DDDD, MMMM D")#</B></CFOUTPUT></FONT></TD></TR>

<CFLOOP QUERY="events">
<CFIF (((DateCompare(events.startdate, celldate) IS -1) OR
(DateCompare(events.startdate, celldate) IS 0)) AND
((DateCompare(events.enddate, celldate) IS 1) OR
(DateCompare(events.enddate, celldate) IS 0)))>
<!--- <CFIF (events.startdate LTE celldate) AND (events.enddate
GTE celldate)> --->
<!--- <CFIF celldate (GTE events.startdate) AND (LTE
events.enddate)> --->
<!--- Date for this cell is >= startdate AND <= enddate
so print the event --->
<TR><CFOUTPUT>

<TD>#events.eventname#</TD><TD>#events.location#</TD><TD>#DateFormat
(events.startdate, "M/D/YY")# #TimeFormat(events.eventtime, "hh:mm
tt")#</TD>
</CFOUTPUT></TR>
<CFSET found = 1>
</CFIF>
</CFLOOP>
<CFIF NOT isDefined("found")>
<TR><TD COLSPAN="3">No events listed for this
date</TD></TR>
</CFIF>
</CFLOOP>

</TABLE>


------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to