May be better is to add just editboxes based on variables, let user to fill the data, and after you press the button, the variables are saved into table. In this way you have whole process under control.
why, and what is, if the user insert one line, close the form, can he now insert a second line if he reopend the form:?: If no, you can make a error message in OnInsert Trigger of the table (or directly in Subform), if there still exist a record for record in Main form -> Error(Blablabla);
Sure... modify the subform to use the integer table instead of whatever table is using right now.
Modify also the subform so it keeps a temporary set of records on it, displaying them instead of displaying the integer field (modifying the functions so it reads accordingly the records). Modify it to allow one extra record, if the user enters the record and clicks on the register function, post that line into the table and the limit will increase again by one....
If that's too complicated for you, then just make the subform1 to be non-insert allowed, add a few "text box" on the top of it so you can add values for new lines and the button to "register" so the line goes into the lines as a new record.
I solved in "OnNewRecord" in Subform, searching if exist a record in the table, if exists an error message appear.
Another question:
In other subform, where user can put many lines, this subform is sourcing another table. I want user put a decimal number in a field and refresh a field in principal subform.
Imagine in a shop:
User fill one line for one product. A price field.
Line1: Price 5.00
Line2: Price 10.00
In Principal Form exist a field. Total price.
When user put price 5 in line, Total price in Principal FOrm refresh to 5.
When user put line with 10, principal form refresh (automatically) to 15 (5 + 10).
I try in OnValidate of price in Subform, but Total price in principal form is not refresh automatically...
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I have a Form, in this Form there are 2 SubForms, Subform1 is linked to a table and i want that user can input only 1 line.
I dont understand that you say with "editbox"...
regards
Why?
Modify also the subform so it keeps a temporary set of records on it, displaying them instead of displaying the integer field (modifying the functions so it reads accordingly the records). Modify it to allow one extra record, if the user enters the record and clicks on the register function, post that line into the table and the limit will increase again by one....
If that's too complicated for you, then just make the subform1 to be non-insert allowed, add a few "text box" on the top of it so you can add values for new lines and the button to "register" so the line goes into the lines as a new record.
Another question:
In other subform, where user can put many lines, this subform is sourcing another table. I want user put a decimal number in a field and refresh a field in principal subform.
Imagine in a shop:
User fill one line for one product. A price field.
Line1: Price 5.00
Line2: Price 10.00
In Principal Form exist a field. Total price.
When user put price 5 in line, Total price in Principal FOrm refresh to 5.
When user put line with 10, principal form refresh (automatically) to 15 (5 + 10).
I try in OnValidate of price in Subform, but Total price in principal form is not refresh automatically...