I tried this in a function but with no luck..
the below code that checks the DB and increaases the number works fine.. but i need to cycle back through it if there is a match and variable i has changed to the next number..

so if i exists then
change number to tx.7_224

now recheck db to see if tx.7_224 exists.... etc...

if tx.7_224 does not exist then = newValue


thanks for anyhelp..





Code:
<%
dim i 
dim ID

i = "tx.7_223"

While ((Repeat1__numRows <> 0) AND (NOT rs.EOF)) 
if UCase(i) = UCase(trim(rs("formNumber"))) then
x=len(i)-3
preID = (left(i,x))
ID = CStr(Right(i,3))

ID = ID + 1
if len(ID) >= 3 then 
'continue
elseif len(ID) = 2 then 
ID = "0" & ID
elseif len(ID) = 1 then
ID = "00" & ID
end if
 
i = preID & ID
'response.write UCase(i) & "</br>" 
ELSE
'continue
'response.Write("continue")  & UCase(rs.Fields.Item("formNumber").Value) & "</br>"
END IF
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rs.MoveNext()
Wend

response.write i

%>