473,326 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

It should work but it doesn't...?

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!
Jun 9 '07 #1
1 1374
jhardman
3,406 Expert 2GB
I'm not sure if this will solve all your problems, but the query statement should be like this:
Expand|Select|Wrap|Line Numbers
  1. rs3.Open "SELECT DateVal FROM Budget WHERE DateVal=%" & CDate(Request.Form("newdate")) & "%", adoCon
  2.  
Let me know if this helps.

Jared
Jun 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: AnnMarie | last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it works fine in IE. I made some of the suggested changes which enabled it to work in IE. I couldn't make all the changes...
5
by: Gary Mayor | last post by:
Hi, If I have the ' character within the javascript:pick command it doesn't work. Is there some sort of way of escaping these characters like in server side languages. function pick(symbol) {...
3
by: Matt | last post by:
I want to know if readOnly attribute doesn't work for drop down list? If I try disabled attribute, it works fine for drop down list. When I try text box, it works fine for both disabled and...
12
by: Rhino | last post by:
I am having an odd problem: the sqlj command on my system doesn't work. I am running DB2 (LUW) V8 (FP8) on WinXP. I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the...
14
by: Steve Jorgensen | last post by:
Recently, I tried and did a poor job explaining an idea I've had for handling a particular case of implementation inheritance that would be easy and obvious in a fully OOP language, but is not at...
6
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType =...
4
by: bbp | last post by:
Hello, In an ASPX page I have a "Quit" button which make a simple redirect in code-behind. This button doesn't work no more since (I think) I moved from the framework 1.0 to 1.1 and it doesn't...
3
by: Dave Moore | last post by:
Hi All, Ok, here's my problem. I want to open a file and process its contents. However, because it is possible that the file may not exist, I also want to check whether the file() function is...
33
by: bonk | last post by:
I have an application that needs to perform some background work, i.e. Logging, wich must not block the main thread. How would I basically design such a scenario? It is obvious that I should do...
10
by: Sourcerer | last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and tried to run it on my friend's computer (he doesn't have the compiler). We both have Windows XP Professional. I have .NET...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.