[SOLVED] open form to new record

How does one open a form to new record (rather than first record in record set)?

I have a grid with several orders. The order ID (in the grid) has a linked field to the orderDetail form. Currently the default SC settings are when the link is clicked to open the form, the form is opened and the first record in the recordset is displayed.

I would like to open a form (using the modal window option) to add new record (order detail).

Thank You!

This is what I have done to “force it”; in the SQL if you have primary key like id put where id < 0

this always open up in insert mode

This is the best way: sc_apl_conf(“Application”, “Property”, “Value”):

Ex. 1: Forces the “my_form” application to start in the addition mode.
sc_apl_conf(“my_form”, “start”, “new”);

see helpfile for further explanation. Put this tiny macro in your init event.

2 Likes

Thank you for the help!!
@aducom = solution worked!:smiley:

if you are using grid_edit_view in the associated form like invoice, than its not working at all, because as long you save the record, it will not display the saved record, and goes again on New Blank Record and you can’t see the grid_edit_view for invoice items.

hope you understand.

i disadvantage of ,“start”,“new” is that the app stays in insert new record, so after inserting a record it leaves the record you edited and opens a new insert empty form.
it is really a shortcoming of SC , management of form states is a mess.

If I remember correctly, setting a form primary key to -1 makes SC open a form in new record mode.
E.g,with sc_redir: sc_redir(appname,idfield=-1);
Should works also with link settings: set the called app id field to “Fixed” and its value to -1

3 Likes