Editable = No not working :?:

tompynationtompynation Member Posts: 398
I have a subform based on the folowing table:

Enabled Field No. Field Name Data Type Length Description
Yes 1 ID Integer
Yes 2 FabricatieID Integer
Yes 3 Fabricatienr Integer
Yes 4 Item Code 20
Yes 5 Hoeveelheid Decimal
Yes 6 Type Text 1
Yes 7 Verwerkt Boolean
Yes 8 Omschrijving Text 50

The property Editable of the field Item has been placed to No inside the table

And on the subform i've placed the Editable to No for the column Item

In the table there is following code for the Item field:

Item - OnValidate()
lv_Item.GET(Item);
Omschrijving := lv_Item.Description;
MODIFY;

In the Subform there is the following code for the Item column:

Item - OnLookup(VAR Text : Text[1024];) : Boolean
lv_Item.RESET;
IF gv_CatFilter <> '' THEN BEGIN
IF (gv_CatFilter = 'F') OR (gv_CatFilter = 'V') THEN
lv_Item.SETFILTER(lv_Item."Item Category Code",'%1',gv_CatFilter)
ELSE IF gv_CatFilter = 'A' THEN
lv_Item.SETFILTER(lv_Item."Item Category Code",'%1|%2|%3',gv_CatFilter,'L','S');

IF FORM.RUNMODAL(31,lv_Item) = ACTION::LookupOK THEN BEGIN
Item := lv_Item."No.";
Omschrijving := lv_Item.Description;
END;
END;

Now, how come that i can still change the field Item throug the subform when i've placed the Field as Editable = No in table and Subform?

I can olny change it through the lookup functionallity in the subform

Answers

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Not editable means not editable for users. You can still edit the field via code.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • kamel.hedikamel.hedi Member Posts: 61
    Hi tompynation,

    U said : I can olny change it through the lookup functionallity in the subform : so u have the risponse.

    Editable = No in the field (of the table) and Editable=No in the subform control : that mean u can't modify manually this field (try to tape something on the field : u can't....)
    But using the lookup action, u have a code telling the system to take the value of the field "No." from table Iv_Item and assign it on ur record.

    IF FORM.RUNMODAL(31,lv_Item) = ACTION::LookupOK THEN BEGIN
    Item := lv_Item."No.";
    Omschrijving := lv_Item.Description;
    END;

    END;

    with ur code, u shoud have the item N° changed and also the description.. ? I m right ?

    Try to comment this 4 lines
    //IF FORM.RUNMODAL(31,lv_Item) = ACTION::LookupOK THEN BEGIN
    //Item := lv_Item."No.";
    //Omschrijving := lv_Item.Description;
    //END;
    HKAMEL
  • tompynationtompynation Member Posts: 398
    yes, but the lookup shouldnt be working anymore after i inserted the record...

    So that you cannot change the Item field, so if you choose the wrong Item,
    You should delete this line, and create a new line with the correct item...
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Item - OnLookup(VAR Text : Text[1024] : Boolean
    IF Item = '' THEN BEGIN
      lv_Item.RESET;
      IF gv_CatFilter <> '' THEN BEGIN 
        IF (gv_CatFilter = 'F') OR (gv_CatFilter = 'V') THEN 
          lv_Item.SETFILTER(lv_Item."Item Category Code",'%1',gv_CatFilter) 
        ELSE IF gv_CatFilter = 'A' THEN 
          lv_Item.SETFILTER(lv_Item."Item Category Code",'%1|%2|%3',gv_CatFilter,'L','S'); 
    
        IF FORM.RUNMODAL(31,lv_Item) = ACTION::LookupOK THEN BEGIN 
          Item := lv_Item."No."; 
          Omschrijving := lv_Item.Description; 
        END; 
      END;
    END;
    
    "Money is likewise the greatest chance and the greatest scourge of mankind."
Sign In or Register to comment.