SETRANGE not applicable on value red|blue

Hi all,

i want add restriction on posting of item journal as per location  for that i have done following implementation:

usersetup table:91 created field :loc. area       code      200  run table adding value to this field as red|blue|green

on item jounal onaction of post addid code as:

UserSetup.RESET;
UserSetup.SETRANGE("Loc area",Rec."Location Code");
IF UserSetup.FIND('-') THEN
BEGIN
CODEUNIT.RUN(CODEUNIT::"Item Jnl.-Post",Rec);
CurrentJnlBatchName := GETRANGEMAX("Journal Batch Name");
CurrPage.UPDATE(FALSE);
END
ELSE
MESSAGE('USER NOT VALID FOR THIS LOCATION: %1',"Location Code");

now it not allowing to post user with location code as blue,and red on item journal it giviong me error message why so.

Related
Recommended