I have a month and year that I am passing from another page and I want to compare it to the current date and even when they are the same it's not recognizing them as being the same.
Here's the code:
The first part that is hardcoded with the 10 and "2006" works but the part where it compares isn't. Everything that ends up in the first Else statement winds up going to the last Else statement because it doesn't see that it matches the others.
Here's the code:
Code:
sMonth = Request.Form("Month")
sYear = Request.Form("Year")
CurrentMonth = Month(Date)
CurrentYear = Year(Date)
If CurrentMonth < 10 Then
CurrentMonth = "0" & CurrentMonth
Else
End If
If sMonth < 10 and sYear = "2006" Then
Response.Redirect("No.asp?Error=3")
Else
If sMonth = CurrentMonth and sYear = CurrentYear Then
Response.Redirect("No.asp?Error=4")
Else
If sMonth > CurrentMonth and sYear = CurrentYear Then
Response.Redirect("No.asp?Error=4")
Else
Response.Redirect("BHSurveyResults.asp")
End If
End If
End If
The first part that is hardcoded with the 10 and "2006" works but the part where it compares isn't. Everything that ends up in the first Else statement winds up going to the last Else statement because it doesn't see that it matches the others.