This topic is locked

If statments not working

6/16/2006 8:39:19 AM
ASPRunnerPro General questions
B
barljo00 author

I have a couple of pages that I'm checking the new value to the previous value in the table during an edit. When the 2 fields are displayed, they are equal, but the IF statment is giving a not equal result. I've tried numerous things and nothing is working. The form for PRCost_ProjectedBudget validates as a numeric field and the table entry is Access - Number/Long Integer.
Here is a sample of the code:
iPRCost_ProjectedBudget = GetRequestForm("PRCost_ProjectedBudget")
strSQLExists = "select * from MonthlyReleaseStatus where PRCost_ID =" & iPRCost_ID
set rsExists = CreateObject("ADODB.Recordset")
rsExists.Open strSQLExists, dbConnection
if not rsExists.eof then
Response.Write "; record budget = " & rsExists("PRCost_ProjectedBudget")

Response.Write "; Form budget = " & iPRCost_ProjectedBudget
Session("iPRCost_Month") = rsExists("PRCost_Month")
if iPRCost_ProjectedBudget = rsExists("PRCost_ProjectedBudget") then

else

strPRCost_Justification = GetRequestForm("PRCost_Justification")
if strPRCost_Justification = "" then

%>

<script>

alert("Projected Budget changed, but no Justification entered. Please correct")

</script>

<%

BeforeEdit = False

end if

end if

end if
rsExists.Close : set rsExists = Nothing

Sergey Kornilov admin 6/16/2006

Joan,
use can use Response.Write to print actual values of variables you comparing.
Also if you compare numeric values use functions CLng() or CDbl() to make sure you comparing apples to apples.

B
barljo00 author 6/16/2006

Yes, I was using the response.write to see the data and that's how I knew the If wasn't working. Thanks for the help. I got it to work.
Joan