Add new line in form

Hi, does anyone know how to move the focus to an new line in a Tabular-type form using codeunit? I designed a Tabular-type form to input, and I want to move the cursur to last line as an new line after any input. It will highly appreciated for any help.

Hi. The following exampleputs the focus to the last record. The ‘find’ statement tells Navision to go to the last record. This way you can set the focus on any record you want: use rec.Get(key) instead of find. I hope this is of any use for you. vars" rec : record subtype: the table that you are using fo: the tabular type form that you want to use. -------- rec.FIND(’+’); fo.SETRECORD(rec); fo.RUNMODAL; Martin Pennings Sittard Netherlands

Thank you, but not what I mean. When we move the cursor down to the last line, the status bar will indicate as new, mean we insert an new record. I would like to control in program that after user input, the cursor will be put to last empty line as to insert an new record. again, thansk as the same.

OK,got the point now. The problem is that at the moment a new record is inserted, Navision sorts the table on the primary key. What you can try is the folowing: After the user has entered the last record, you generate a new record (in the code). The primary key of this new record must-alphabetacally- be directly after the last one. This is a very complicated way, but the only-one I can think of now. Ofcours this method means that the user will not be possible to enter the primary-key him(or her)self. I hope this will help you more, knowing it’s probably not the easiest and best way. Martin Pennings Sittard Netherlands

Martin, Your idea should work but it’s quite tricky anyway. Let’s take as example the well known Sales order line (T37) where the next free record is very easy to insert: Providing that the user switches several times between sales header and sales line, each time a new line would be inserted at the bottom. Therefore additional coding would be necessary to determine whether a real line has been inserted by the user (e.g. ItemNo <> ‘’); not used inserted blank lines would have to be deleted etc. Marcus Marcus Fabian phone: +41 79 4397872 m.fabian@thenet.ch

Thank for your reply. unfortunately the field I like to input is in part of Primary key. Now, I add a text box in form and insert an new record after user inputing, then update tabular form and keep focus on this text box again, so user can keep inputing one by one. Thanks for your kindly help. Frank