Run a form in insert mode?

tompynationtompynation Member Posts: 398
How can i run a form on a click off a button, the form should open without showing a record...

So it should be ready to insert a new record.

If i just do FORM.RUNMODAL('myform'), then it shows the first record of the table and i still have to press F3 to insert...

Answers

  • krikikriki Member, Moderator Posts: 9,110
    Is it so much work for the user to hit F3?

    Remember : each line of extra code will make it more difficult for a later upgrade. And the usefulness of showing a new record on opening the form seems very limited.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • tompynationtompynation Member Posts: 398
    no its not difficult to press F3, but i open this form by Pressing on a button 'New'

    So its pretty stupid that when you press 'New' and then see the form to insert that you still have to press F3 to be able to insert...
  • tompynationtompynation Member Posts: 398
    allright, i solved it otherwise. i already insert when pressing the 'New' button and then i just show this newly inserted record where just the ID is filled in.
  • DaveTDaveT Member Posts: 1,039
    Hi tompynation,

    Be careful with this approach - it can leave a lot of blank record on your table if the user exits out. A simple solution is to use sendkeys and send an F3 on activate on the create form
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • tompynationtompynation Member Posts: 398
    why should this create blank records?

    I have an Cancel button also in this form where the user should enter the data for this new record.

    I just check if all Fields are empty, if so i delete the rec

    Same code in the onclose form
  • DaveTDaveT Member Posts: 1,039
    Hi tompynation,

    It's fine if you control all the potential exits but users can unfilter the record, navigate to a different record and exit from that valid record. Or my particular favourate is that if you filter on the code (assume is the key) and hit next, then the form thinks its inserting a new record with the code. If you then exit and your code deletes blank then it deletes a valid record.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • tompynationtompynation Member Posts: 398
    mm i didnt thought about that one... #-o
    Guess i will use the sendkey function then.

    How does this work?
  • DaveTDaveT Member Posts: 1,039
    Have a search on the forum there's lots of posts - basically it's code to allow you send key presses to the software as if the user has pressed the keys.

    e.g.
    http://www.mibuso.com/forum/viewtopic.p ... t=sendkeys

    Have fun !
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.