Forums

ASP

This topic is locked

Different value from RS based on day of the week

Posted 03 Dec 2003 20:29:10
1
has voted
03 Dec 2003 20:29:10 Kobe Bryant posted:
How do I get a different value from a recordset based on the day of the week?

My 2 tables are:

tblHour
------------------------------------

hrID hrMonday hrTuesday hrWednesday
1 12:00 14:00 16:00
3 10:00 11:00 12:00


tblCat
------------------------------------

catID catName catHourLink
432 andrew 1
434 mark 3
454 anthony 3


This is the result I'm looking for:

on Monday,

Andrew 12:00
Mark 10:00
Anthony 10:00

on Tuesday,

Andrew 14:00
Mark 11:00
Anthony 11:00

on Wednesday,


Andrew 16:00
Mark 12:00
Anthony 12:00


Here's a code I have, but the problem is that it doesnt work in a repeating
table.

<% strDate = Now() %>
<%

Dim OpenCat

If WeekDayName(WeekDay(strDate)) = "Friday" Then
OpenCat = rsTime.Fields.Item("hrMonday".Value

ElseIf WeekDayName(WeekDay(strDate)) = "Saturday" Then
OpenCat = rsTime.Fields.Item("hrTuesday".Value

Else
OpenCat = rsTime.Fields.Item("hrWednesday".Value

End If
%>

Any Help is greatly appreciated

Reply to this topic