I am truly a CF-Newbie and have been learning by doing so please forgive the basic nature of this post. With that said, I am in the process of developing an Intranet site for my school which, as part of the main page that displays our weekly annoucements, etc. is a place to show who is off campus today (conferences, vacations, etc). The code I now have works if there is a range of dates, i.e., 11/1/2005 (LeaveStart) to 11/4/2005 (LeaveEnd) in our DB. However, if LeaveStart and LeaveEnd are the same, it returns no value from the DB which I am sure has to do with the fact that LeaveStart and LeaveEnd are set to midnight for the time and the Now() value would then not fall BETWEEN them. What I'm having trouble using is the DateFormat on a value from the DB in my sql statements, i.e.
WHERE #DateFormat(todaysDate, "mm-dd-yyyy")# between #DateFormat(LeaveStart, "mm-dd-yyyy")# and #DateFormat(LeaveEnd, "mm-dd-yyyy)#" as I get an "Variable LEAVESTART is undefined" error. Any advice that points me in the right direction would be appreciated greatly. Thanks, Jason <!---------- PARTIAL CODE SECTION -------------------> <cfset todaysDate = Now()> <!--- Query Selects Leave Information Today Only ---> <cfquery name="rsGetLeaveToday" datasource="IntranetApp"> SELECT EmpFirst,EmpLast,LeaveStart,LeaveLoc FROM dbo.tbl_Leave WHERE #todaysDate# between LeaveStart and LeaveEnd </cfquery> <cfif (rsGetLeaveToday.LeaveStart) NEQ ""> <cfoutput query="rsGetLeaveToday"> #rsGetLeaveToday.EmpFirst# #rsGetLeaveToday.EmpLast# (#rsGetLeaveToday.LeaveStart#) <br> </cfoutput> <cfelse> No one is off campus... </cfif> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1496 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
