This detects duplicates when inserting a record, but when an existing record is updated it complains on my error page that the field entry already exists, when the unique field has not been changed. A condition probably needs to be applied to the WA Server Validation entry that checks that $totalRows_recordsetname numeric range is from -1 to 0.
in my case:
$WAFV_Errors .= WAValidateNM($totalRows_rsChkRefNo . "",-1,0,0,",.",true,4);
Code blocks are in this order: