troubleshooting Question

Replacing conditions of an If /Elseif with database fields

Avatar of rebaldy1
rebaldy1 asked on
Programming
2 Comments1 Solution191 ViewsLast Modified:
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
    'do something
   
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
Else
    'do default
   
End If

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
    'do something
   
Else
    'do default
   
End If

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?

Thanks


ASKER CERTIFIED SOLUTION
gament

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros