Its a easy task..
use a text change event for that textbox...
when a text change event occurs,store that in integer variable,then move the recordset to first and use a while loop to compare with each row... if it find then say a message that it already exists and clear the textbox using Tex1.text=""
assume there is a roll number field in a database called "rno"...and i have use the adodc control to connect the database
private sub text1_change()
dim n as integer
n=val(text1.text) //n contains number value from text box
adodc1.recordset.movefirst //move the control to first record
while(adodc1.recordset != EOF) //while loop to see if it is End of file
if (adodc1.recordset.fields("rno")= n) then //check if n value matches with the rno field value
msgbox"Already exists" //if exists msgbox pops
text1.text="" //makes the text box null
else
adodc1.recordset.movenext //if it not equal,then move to next record
endif
wend
end sub
the while loop runs until the eof file,if number doesnt matches with the rno field,no thing happens,if it matches it clears the text box and gives a message that it already exists..
hope it helps