Frank,
First, be sure your table is buffered. (I think this is the default when you're using the form builder, but check anyway) Next, in your Valid() code, use a SELECT of the base table looking for the SSN. A SELECT statement will look at the NON-buffered version of the table, so it won't see the record you have just added.
cSSN = this.value
SELECT ssn from MyTable ;
WHERE ssn = cSSN ;
INTO cursor MyTemp
IF _tally > 0
=messagebox("Hey, Stupid, you entered that one before!", 16, "Duplicates")
lRet = .f.
ELSE
lRet = .t.
ENDIF
USE in MyTemp
return lRet
HTH
Barbara
>to all,
>i have a form that was built using the form builder. i selected a table to use and it uses the txtbtns for record manipulation. the table i am using is a .dbf not .dbc file. anyhow if i am adding a record and have a valid event behind a textbox(one of the fields from the database file), and it does not meet the valid event criteria, i want to be able disregard the transaction. what is best way to do this.
>
>for example if i have a ss# that does not match a ss# that is in the master table i do not want this record added. i want to put something the valid event of ss# textbox to automatically go back to the textbtns with everyting enabled, not just save and revert.
>help.
>thanks
>frank