Using 7.1 Asprunner Pro.
Haven't used loop statements too often with existing records. Does anybody have a suggestion? My code below
Trying to loop back to exists statement if number already exists and auto add non-existing number in BEFORE ADD EVENT__. As I was using commented code try again duplicate number.!
Randomize
values("fldrandom") = (Int( (8 - 0) * Rnd + 1 ))
'** Check if specific record exists ****
strSQLExists = "select * from Main where fldrandom=" & values("fldrandom") & ""
set rsExists = CreateObject("ADODB.Recordset")
rsExists.Open strSQLExists, dbConnection
if not rsExists.eof then
' if record exists do something
BeforeAdd = false
'Response.write "Duplicate Random Number Try Again"
else
' if dont exist do something else
BeforeAdd = True
end if
rsExists.Close : set rsExists = Nothing