Clear All fields in a form

Hello,

I'm sorry if this question has already been asked before but I couldn't manage to find an answer to it.

a form has been created with a couple of fields, checks marks, and an "Add" button which will add all these fields into a table. My question is I want once that button is pressed all these fields in the form cleared and ready to be filled with other values so it could be added into the table as well

Thanks in advance.

Best Answer

Answers

  • lubostlubost Member Posts: 627
    - your description seems to used global variables instead of table fields. Why? With table fields no Add button needed
    - clearing all global variables must be done by code behind the Add button
  • mustafaAlsoufimustafaAlsoufi Member Posts: 63
    Thank you for your reply.

    I'm not using global variables, The only global variable is a Rec variable to access the table. what I'm doing is
    Table.field := field; to insert what the user is filling the fields with in the form into the table.

    once the user insert these fields into the table using the "Add" button, I need all these fields in the form to be cleared so the user can add another line into the table with different values into these fields

    The following code is the code behind the "Add button"


    UserRec.RESET;
    UserRec.SETRANGE("Trade Partner No.", "EDI Document No.",Code);

    // If the record already in the table then the following message should appear without inserting a new //line

    IF (UserRec.FIND('=')) THEN
    MESSAGE('The record already exists') ELSE BEGIN

    UserRec.INIT;
    UserRec."Trade Partner No." := "Trade Partner No.";
    UserRec."EDI Document No." := "EDI Document No.";
    UserRec.Type := Type;
    UserRec.Code := Code;

    UserRec."Header Status Send Only" := "Header Status Send Only";
    UserRec.Description := Description;
    UserRec.Header := Header;
    UserRec.Line := Line;
    UserRec."Clear Line Codes" := "Clear Line Codes";

    UserRec.INSERT;
    MESSAGE('The table has been updated');

    // I need to clear all the fields here, after inserting it into the table.
    END;

    Please let me know if my description is not clear or if you have any questions to help you answer mine.
Sign In or Register to comment.