Disable a field in a record based on a value in anoth field

david.weeksdavid.weeks Member Posts: 96
edited 2004-02-23 in Navision Attain
Hello All,

Should be simple this one but its not quite clicking...

I have a field called Sentforapproval. This is boolean.
This exists within the Sales Quote subform and within Sales Line.

If this is set to TRUE, I want to make the entire record un-editable, if the user goes back into the quote.

I have tried various methods including (for example) the setting of the currform.quantity.editable(false) within various sections including OnNextRecord etc.

It seems to work for one record but if there are three records in the subform, and not all have Sentforapproval = TRUE, they still get set to editable(false). This is the same if you navigate to another record, even if the particular sentforapproval is set to FALSE, the field in question remains locked.

Any ideas?
Am I missing something simple?

Comments

  • Dean_AxonDean_Axon Member Posts: 193
    Hi David,

    Try transferring your field to the header record. This will then allow you to choose any of the three lines on that subform and ALL will show the same status.

    Then the code can be something quite easy such as...

    If Header.SentForApproval=true then
    Currform.Subformname.Editable=False
    else
    Currform.Subformname.Editable=True;

    where Subformname is the name that you apply to the subform.

    you will need to put this on the various triggers so that it cannot be bypassed by changing records etc..

    Hope it helps. :D
    Remember: Keep it simple
  • wonmowonmo Member Posts: 139
    If you want to set selective editablity to the subform where some records are editable and some not then create a procedure for the main form and subform which accepts a boolean parameter which then sets editablility. If you want to make the entire subform non-editable then just create the function on the main form.

    All you have to do then is to call this procedure on the OnOpen and OnAfterGetRecord triggers.

    ie.
    p_SetEdit(Sentforapproval = TRUE);
Sign In or Register to comment.