Replacing conditions of an If /Elseif with database fields
Posted on 2003-02-20
I am probably just having a brain fart, but I cant seem to see this answer.
I have the following code that works fine:
If ((navmonth = 4 And dateCounter > 4) Or (navmonth = 5 And dateCounter < 12)) And (Calendar = "Turkey") Then
ElseIf ((navmonth = 9 And dateCounter > 26) Or (navmonth = 10 And dateCounter < 27) Or (navmonth = 11 And dateCounter >= 1) Or (navmonth = 1 And dateCounter < 5) Or (navmonth = 12)) And (Calendar = "Whitetail Archery") Then
'do something else
However, as you can see the conditions are hard coded. I need this app to be dynamic, fed by a database. I have set up a database and would like to sub the condtions of the If/elseIf for the values in the recordset. I will need to loop through the records to see if the conditions will be true for each record. Basically this populates an ASP Calendar. I have the following code that works if I only have one record in the database:
dateSelect = navmonth & "/" & dateCounter & "/" & navyear
CalDate = cdate(dateSelect)
If (CalDate >= RSSeason("DateOpen") And CalDate <= RSSeason("DateClosed")) And (Calendar = RSSeason("Game")) Then
But if I use a Loop, I get multiple days(on the calendar) for each record in the table. The only other ways I see scramble my conditional statements. Any Ideas, its 5 in the morning and I am out of steam?