Hi,
I have a field in table which has to be unique, nonetheless it cannot be primary key as well. I was just wondering if there's any way to stop double entry in such situation. Any ideas please!!!
Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
0
Answers
RecVendor.SETRANGE(RecVendor."T.I.N. No.","T.I.N. No.");
IF RecVendor.COUNT >1 THEN
ERROR('Tin No. already exists')
ELSE
RecVendor.RESET;
if the field gets entry from the form write the code on the onafterValidate of the field as well.
Ritesh K Singh
RIS Plus, LLC
MVP - Business Apps
Get works ONLY on the primary key.
Forgot to write if "val.findfirst then;";
try this:
val.SETRANGE(val.No, No);
if Val.findfirst then;
IF not val.isempty THEN
ERROR('Number already exist!');
Ritesh K Singh
You don't need this. ISEMPTY is enough and skip the database call to select the first record.
It's working...
mixed two codes...
:oops:
Ritesh K Singh