This topic is locked

Highest Number

12/18/2007 2:51:04 PM
ASPRunnerPro General questions
J
JOHNF777 author

I've got 2 tables. Table1, BarLong
Table1 - TableKey, Key1, Key2, Num1, Num2, High

BarLong - Key, High1
Key1 & Key2 are manually entered. Then, Table2 is read to get High1 to store into Num1.

I'm storing Key1 and Num1 with data from Table2, Key2 & Num2 with data from Table2, etc. and the highest number from Num1, Num2 into High.

My issue is I couldn't get to "store" HIGH.

I'm trying to get the highest value in the fields Num1 or Num2 to store in HIGH.
Here's a sample code I have in BeforeAdd:
[codebox]str = "select from BarLong where Key='" & dict("Key1") &"'"

Set rtTemp = server.CreateObject("ADODB.Recordset")

rtTemp.open str, dbConnection

dict("Num1") = rtTemp("High1")

rtTemp.Close : set rtTemp = Nothing
str = "select
from BarLong where Key='" & dict("Key2") &"'"

Set rtTemp = server.CreateObject("ADODB.Recordset")

rtTemp.open str, dbConnection

dict("Num2") = rtTemp("High1")

rtTemp.Close : set rtTemp = Nothing
If dict("Num1") > dict("Num2") then

dict("HIGH") = dict("Num1")

else

dict("HIGH") = dict("Num2")

End If[/codebox]
If I try to enter the numbers into Num1 and Num2 manually without reading the other table. The "IF" function works.
Can someone see what I may be doing wrong?
Thanks in advance.