FORM.RUNMODAL, Focus

I am opening a form in code using FORM.RUNMODAL There are records in the table. When the form opens I want the cursor, or focus, to be at the end of the records on a new line where the user can begin to enter a new record without using the mouse or keyboard to press F3 or arrow down to a blank line. Is this possible?

hi, if you don’t need to display the existing entries, this may be a solution. rec.reset(); rec.setrange(PrimaryKey,’’); frm.settableview(rec); frm.runmodal(); set a filter on your primary key field, in order to get 0 records back. best regards feri

Thanks for you help, but we need to display the existing entries. Any other ideas from anyone?

Hi SM, In Form - OnOpenForm Trigger() write FIND(’+’) then cursor will be focused on the Last Record. Thanks

I created a form based on table 81. In OnOpenForm I wrote: IF NOT FIND(’+’) THEN; CurrForm.SETSELECTIONFILTER(Rec); SETRANGE(“Line No.”); //remove filter on this field INIT; “Line No.” += 10000; INSERT; Now focus is on this new record…

Thank you Anfinnur. That is closer and almost works. The problem is the new record is already inserted, when the user enters the new data they get the “Do you want to Rename the record?”. I need the focus to be on a blank record in insert mode.

Try this: In OnOpenForm set filter with no records in it. For table 81 it could be: SETRANGE(“Line No.”,0); In OnNewRecord remove your filter: SETRANGE(“Line No.”);