Editable=TRUE in form but Subform still uneditable

JedrzejTJedrzejT Member Posts: 267
I put this code in form

OnAfterGetRecord
IF "No."<> xRec."No." THEN CurrForm.EDITABLE(FALSE);

I create new button "Edit" ](*,)

OnPush:
IF CurrForm.EDITABLE(TRUE) THEN MESSAGE('Your'in edition mode');

When i push that button.. form is editable..but subform still not

Anybody know this problem??

Comments

  • jmjm Member Posts: 156
    Hi,

    you need a funtion in the subform too, and you have to call them:

    OnAfterGetRecord
    IF "No."<> xRec."No." THEN CurrForm.EDITABLE(FALSE);
    SubForm.DoEditable();

    DoEditable
    CurrForm.EDITABLE(FALSE);

    br
    Josef Metz
    br
    Josef Metz
  • JedrzejTJedrzejT Member Posts: 267
    I check it ..sorry don't work.

    1.CurrForm.Editable(FALSE) = form with subforms is set to uneditable

    in this logic

    2.CurrForm.Editable(true) = form with subforms is set to editable

    but second didn't works
  • JedrzejTJedrzejT Member Posts: 267
    jm wrote:
    Hi,

    you need a funtion in the subform too, and you have to call them:

    OnAfterGetRecord
    IF "No."<> xRec."No." THEN CurrForm.EDITABLE(FALSE);
    SubForm.DoEditable();

    This works fine. Form is uneditable

    Code in button don't work
  • kinekine Member Posts: 12,562
    I think it can be problem of update of the form. Try to call CurrForm.UPDATE(False) after the change. Sometime the subform looks like noneditable but when you click on the form, you can edit...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • JedrzejTJedrzejT Member Posts: 267
    Thanks for advice

    I already try it "currform.update(false)". Nothing helps.
    When i put on form one subform user, after push "Edit" button sometimes must click subform,form,subform and then subform is editable.

    When i put 2 subform on my form.. problem is bigger. second subform sometimes is non editable, no matter if he click few times everywhere
  • kinekine Member Posts: 12,562
    You need to call the CurrForm.UPDATE in the subform form... you need to create function with this command, and call this function from the main form... CurrForm.UPDATE does not update subform....
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • JedrzejTJedrzejT Member Posts: 267
    Thanks

    Belive me , I try thif functions everywhere Update,Activate,Editable
    I stuck on this from yesteday ](*,)

    OnAfterGetRecord,OnPush - "edit" button" (currform and subforms),OnActivate,Deactivate subform

    Nothing helps.. :-s
  • dlauwersdlauwers Member Posts: 127
    Hello,
    I had this same thing on a form with multiple subforms.
    It reacts very wierd when moving between records ! C/Side code is correct.

    But it seems onces disabled (this happens when you scroll to a record via < and > icons to one thas has a status that would disable the subform) the subform remains disabled until you scroll by a record that has data in the subform.
    Only then the subform would enable again and show the data (when the editable flag was set to true ofcourse).
    I also tried the currform.update(false) in form and subform etc... no effect.
    Even if you scroll back from the record B where the subform was uneditable to record A where the subform initialy was editable, the subform remains uneditable.

    I solved my problem by instead of using the editable propertie on the subform and try to set that true or false according to the content of a field, I used the Enabled properties of the controls in the grid of the subform.

    The effect for the enduser is the same, he cannot edit data or click inside the grid. And when I switch from record to record the fields are now correcty enabled or disabled according to the status of the toplevel record.

    Weird problem, but this is my workarround ! #-o

    Danny
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Hi,

    I don't know why but I've noted that sometimes it depends on what you've set as starting value of Editable property.

    Set Editable to Yes, save the form, check if works. Do the same for subform.

    Regards,
    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.