Didn't test it, but don't you have to do an INIT (clear all values) instead of a CLEAR(Rec)?
No, you also need to clear the primary key. INIT clears all except the fields of the primary key. And the INSERT(TRUE) triggers the code to generate a new primary key.
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I was only thinking of how I do it, and if I create a new record, i do "INIT" and then fill in the primary key fields, so I don't have that issue. In this case, it's necessary indeed to clear the PK as well ...
New Menu Button with one Menu Item "Test" and Shortcut F3.
New Command Button named "New" with this code in the OnPush Trigger:
Clear(rec);
init();
Insert(True);
I put the CommandButton over the Menu Button so the User cant see the Menu Button.
After running the Form nothing happend on hitting F3, because the Shortcut on the Menu Item overwrites the existing Shortcut F3.
I there is a No. Series for the Customer you will receive a new Record after clicking the "New" Button. Otherwise you have to fill in the PK -Fields directly in the OnPush Trigger.
I don't understand why you would create a button that does the same thing as F3, give it the shortcut F3 and it would do the same.... Couldn't you just better leave the whole thing alone? That way, when you hit F3, it will act as though you hit F3, because you just hit F3 :shock: go figure...
Normally we press F3 to Insert New Record. If We dont use F3 and want to
create button to Insert New Record.How to do that ? Any body can do?
I dont think that it is a good idea not to use the Navision functionality for this think, but maybe there are some special reasons
By the way,
the menu button dosnt do the same as F3!! It prevents the user for using "normal" F3! To Insert a new record you have to push the Command Button with your own code.
I was trying to be sarcastic in my last post :shock: sorry if that didn't come through. Of course people have reasons to do things, and to them they are perfectly valid. Just ask my wife, she'll tell you I am weird, when I think everything I do makes perfect sense
Comments
create button to Insert New Record.How to do that ? Any body can do?
Just search this forum for examples.
Do It Yourself is they key. Standard code might work - your code surely works.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Personally, I use the "Mark Brummel"-way ... simulate "F3" with the sendkeys...
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
After your answer, I couldn't call it the waldo-way anymore
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I was only thinking of how I do it, and if I create a new record, i do "INIT" and then fill in the primary key fields, so I don't have that issue. In this case, it's necessary indeed to clear the PK as well ...
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC
This way the filters the user has set remain, just like using F3.
i tried the following on the Customer Card:
New Menu Button with one Menu Item "Test" and Shortcut F3.
New Command Button named "New" with this code in the OnPush Trigger:
Clear(rec);
init();
Insert(True);
I put the CommandButton over the Menu Button so the User cant see the Menu Button.
After running the Form nothing happend on hitting F3, because the Shortcut on the Menu Item overwrites the existing Shortcut F3.
I there is a No. Series for the Customer you will receive a new Record after clicking the "New" Button. Otherwise you have to fill in the PK -Fields directly in the OnPush Trigger.
RIS Plus, LLC
i once tried it, but wasnt able to make it work
its only an idea for solving mootoon's problem.
Normally we press F3 to Insert New Record. If We dont use F3 and want to
create button to Insert New Record.How to do that ? Any body can do?
I dont think that it is a good idea not to use the Navision functionality for this think, but maybe there are some special reasons
By the way,
the menu button dosnt do the same as F3!! It prevents the user for using "normal" F3! To Insert a new record you have to push the Command Button with your own code.
Regards,
Frank
RIS Plus, LLC