Check if field value already exists

Hi Everyone

Hoping someone can help with this one quick please?

I have an additional field set up in company entity (standard text field)
on Validate Script I'm using some java that checks if the value exists in the database already (like an account number)

var companyRecord = CRM.FindRecord("Company", "comp_c_extrafield='" + Values('comp_c_extrafield') + "'");
if (!companyRecord.Eof)
{ ErrorStr = 'Number exists!';
Valid = false; }

The above script works fine when entering a new record and a new value in the field
The problem with it is - when you select change on that screen, it re-validates when you save and prevents you saving as the value already exists.

If I use it in Create Script it works but the warning is always showing

Can anyone recommend a work-around or alternative way of achieving this result?

Thanks in advance,

Paul