copy form ID to records in subform

tompynationtompynation Member Posts: 398
I've created a form where a user can insert a picture...
On this form i have a subform with a table on it.

When i now insert a new line in the table, i would like to have the form ID also inserted in the subform's table.

How do i transfer my Form ID to my subform record(s)?

Comments

  • tompynationtompynation Member Posts: 398
    i found out how to transfer the ID, but something is going wrong when i go to the next record in my form... the subform lines from my previous record keep standing in my subform untill i click on it a few times.

    And i can only insert 1 record in my subform table?

    This is my code in my subform:
    Form - OnNextRecord(Steps : Integer) : Integer
    TextLayoutRec.SETRANGE(TextLayoutRec."Remark ID", "Remark ID");
    CurrForm.SpecialRemarkLines.FORM.SETTABLEVIEW(TextLayoutRec);
    CurrForm.SpecialRemarkLines.FORM.UPDATECONTROLS;
    
    Form - OnAfterGetRecord()
    CurrForm.SpecialRemarkLines.FORM.SetRemarkID("Remark ID");
    TextLayoutRec.SETRANGE(TextLayoutRec."Remark ID", "Remark ID");
    CurrForm.SpecialRemarkLines.FORM.SETTABLEVIEW(TextLayoutRec); 
    

    And this is the code inside my subform:
    Form - OnActivateForm()
    MESSAGE('onactivateform');
    "Remark ID" := RemarkID;
    
    
    SetRemarkID(FormID : Integer)
    RemarkID := FormID;
    

    This is the table used by my main form:
    Enabled Field No. Field Name Data Type Length Description
    Yes 1 Remark ID Integer
    Yes 3 Picture BLOB

    And this is the table in my subform:
    Enabled Field No. Field Name Data Type Length Description
    Yes 1 Primary Key Integer
    Yes 2 Align Option
    Yes 3 Wide Boolean
    Yes 4 High Boolean
    Yes 5 Bold Boolean
    Yes 6 Italic Boolean
    Yes 7 Text Text 250
    Yes 9 Remark ID Integer
    Yes 10 Line No. Integer

    And this is my form to get a better look of what it does:
    testat8.th.jpg
  • kinekine Member Posts: 12,562
    If you just want to populate fields on subform which are used to link the records to the header record (displayed on the main form) and these fields are not part of Primary key (else they are filled automatically), you can use the PopulateAllFields property on the subform. See on-line help for more info.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.