transfer line doesn't exist error after adding code

Hi all,

Previous consultant has added bar code no in transfer line table and written code to get details of item from barcode.

It is working perfectly but when I added code i’m getting error "transfer line doesn’t exist"while opening form if there is no lines for that order

below is the code. Is there any problem with code. Any clarifications let me know

IF BarcodesRec.GET(Barcode) THEN

BEGIN

VALIDATE(“Item No.”,BarcodesRec.“Item No.”);

Barcode := BarcodesRec.“Barcode No.”;

“Barcode Price”:= BarcodesRec.“Barcode Price”;

“Item No.”:= BarcodesRec.“Item No.”;

VALIDATE(Quantity,1);

“Total Qty”:=1;

“Margin(%)”:=BarcodesRec.“Margin %”;

“Margin Amount”:=BarcodesRec.“Margin Amount”;

PurchRcptLine.SETRANGE(PurchRcptLine.“Document No.”,BarcodesRec.“Purch Recpt doc No.”);

IF PurchRcptLine.FINDFIRST THEN

“Transfer Price” := PurchRcptLine.“Direct Unit Cost”;

“Vendor No.”:=PurchRcptLine.“Buy-from Vendor No.”;

Vendor.GET(PurchRcptLine.“Buy-from Vendor No.”);

“Vendor Name”:=Vendor.Name;

END;

//ADDED CODE FROM HERE

//unique barcode in transfer order

transferline.RESET;

transferline.SETRANGE(“Document No.”,“Document No.”);

transferline.SETRANGE(transferline.“Item No.”,“Item No.”);

IF NOT transferline.ISEMPTY THEN BEGIN

BEEP(300,400);

ERROR(’’);

END;

//taking picture

CLEAR(TransHeader);

IF TransHeader.GET(“Document No.”) THEN;

CLEAR(Item);

Item.GET(“Item No.”);

IF TransHeader.“Picture in T.O” THEN BEGIN

SHELL(‘C:\Users\Subhan\Desktop\New folder\Picture all\calc.bat’);

SLEEP(5000);

Picture.IMPORT(‘E:\Databases\Prasidi silks\image.bmp’);

END

ELSE

IF Item.“Picture item” AND TransHeader.“Default Picture” THEN BEGIN

SHELL(‘C:\Users\Subhan\Desktop\New folder\Picture all\calc.bat’);

SLEEP(5000);

Picture.IMPORT(‘E:\Databases\Prasidi silks\image.bmp’);

END;

May I know where did you write this code?

Under which form/trigger/table/function?

i forget to mention it is written under barcode no on validate of transfer line table

And what are you expecting from this code?

IF NOT transferline.ISEMPTY THEN BEGIN

If you know how to use debugger then activate and check where exactly you are getting error message…

Problem is that though debugger is open it not opening,. So I tried by switching on the Break on triggers

and pressing f5 until I get error. Is it stopping at

form on new record trigger below line

CLEAR(ShortcutDimCode);

if that barcode already exist in that transfer order than it should get error, so I used transferline.isempty,

I tried with findfirst and findset also but giving same error.

Comment this code and try

transferline.RESET;

transferline.SETRANGE(“Document No.”,“Document No.”);

transferline.SETRANGE(transferline.“Item No.”,“Item No.”);

IF NOT transferline.ISEMPTY THEN BEGIN

BEEP(300,400);

ERROR(’’);

END;

same error with that code and without that code but when i run subform from object designer I am not getting error

not even while running tables getting error.

I am getting that error while i was running transfer header form