rs3.Open "SELECT DateVal FROM Budget WHERE DateVal='" & CDate(Request.Form("newdate")) & "'", adoCon
If NOT rs3.EOF Then
Response.Write("It already exists")
Else
Call Save()
End If
rs3.Close
So I have a budget page that I created. When I save changes, I have the option to change the date of the entry. I don't want two entries on the same day. So I have the above check if it already exists. Now for actually saving, it will save to a new day if the day doesn't exist and it will NOT save if it does exist. Here's the kicker. The Response.Write happens no matter what. Also, at the end of the Save() sub it's a redirect which never kicks in. But my normal save also calls the Save() which redirects fine at that time. For the life of me, I can't figure out why. I've tested it like the following:
rs3.Open "SELECT DateVal FROM Budget WHERE DateVal='" & CDate(Request.Form("newdate")) & "'", adoCon
If NOT rs3.EOF Then
Response.Write("It already exists")
Else
Response.Write("It doesn't exist")
End If
rs3.Close
This works perfectly fine and shows the right one. But as soon as I stick in the Save() sub, something messes up. Here's the Save() sub:
<%
Sub Save()
rs1.Open "SELECT * FROM Budget WHERE DateVal='" & CDate(Request.Form("originaldate")) & "'", adoCon, 2, 3
rs1("DateVal") = CDate(Request.Form("newdate"))
rs1("PayAmount") = Request.Form("PayAmount")
rs1("PrevAmount") = Request.Form("PrevAmount")
rs1("TotAmount") = Request.Form("TotAmount")
If Request.Form("BusPassCombo") = "0" Then
rs1("BusPassCombo") = 0
Else
rs1("BusPassCombo") = 1
End If
rs1("RentAm") = Request.Form("RentAm")
rs1("VisaAm") = Request.Form("VisaAm")
rs1("RogersAm") = Request.Form("RogersAm")
rs1("EastlinkAm") = Request.Form("EastlinkAm")
rs1("BusPassAm") = Request.Form("BusPassAm")
rs1("FutureshopAm") = Request.Form("FutureshopAm")
rs1("LeonsAm") = Request.Form("LeonsAm")
rs1("OtherAm") = Request.Form("OtherAm")
rs1("OtherAm2") = Request.Form("OtherAm2")
rs1("OtherDetails") = Request.Form("OtherDetails")
rs1("OtherDetails2") = Request.Form("OtherDetails2")
rs1("Notes") = Request.Form("Notes")
rs1("RemAmount") = Request.Form("RemAmount")
If Request.Form("RentCheck") = "ON" Then
rs1("RentCheck") = "0"
Else
rs1("RentCheck") = "1"
End If
If Request.Form("VisaCheck") = "ON" Then
rs1("VisaCheck") = "0"
Else
rs1("VisaCheck") = "1"
End If
If Request.Form("RogersCheck") = "ON" Then
rs1("RogersCheck") = "0"
Else
rs1("RogersCheck") = "1"
End If
If Request.Form("EastlinkCheck") = "ON" Then
rs1("EastlinkCheck") = "0"
Else
rs1("EastlinkCheck") = "1"
End If
If Request.Form("BusPassCheck") = "ON" Then
rs1("BusPassCheck") = "0"
Else
rs1("BusPassCheck") = "1"
End If
If Request.Form("FutureshopCheck") = "ON" Then
rs1("FutureshopCheck") = "0"
Else
rs1("FutureshopCheck") = "1"
End If
If Request.Form("LeonsCheck") = "ON" Then
rs1("LeonsCheck") = "0"
Else
rs1("LeonsCheck") = "1"
End If
If Request.Form("OtherCheck") = "ON" Then
rs1("OtherCheck") = "0"
Else
rs1("OtherCheck") = "1"
End If
If Request.Form("OtherCheck2") = "ON" Then
rs1("OtherCheck2") = "0"
Else
rs1("OtherCheck2") = "1"
End If
rs1.Update
rs1.Close
Response.Redirect "default.asp?date=" & Request.Form("newdate")
End Sub
%>
And this works perfectly when I call it when the date doesn't change. Any help or insight would be greatly appreciated!