Note: Change the values listed in red to match your specific needs.
//********** Check if specific record exists ************
$strSQLExists = "select * from AnyTable where AnyColumn='SomeValue'";
$rsExists = db_query($strSQLExists);
$data=db_fetch_array($rsExists);
// if record exists do something
// if dont exist do something else
Example
Let's assume we need to check the uniqueness of the entered SSN number. Use the following code in the Before record added event:
//********** Check if specific record exists ************
$strSQLExists = "select * from Clients where SSN='" . $values["SSN"] . "'";
$rsExists = db_query($strSQLExists);
$data=db_fetch_array($rsExists);
// if record exists do something
$message = "SSN " . $values["SSN"] . " already exists."
// if dont exist do something else