Options

Insert a new item automatically

LeroyLeroy Member Posts: 199
Dear sirs, I want to do the following, but I don’t know if it is possible; I’d like that, on create an item, on item form, and on close it, it detects that that item Nº. finish in ING-A and go automatically to create a new item. How can I do that?.
Thanks in advance.

Comments

  • Options
    SavatageSavatage Member Posts: 7,142
    Not sure I understand..

    If you enter an item into the form and close it - it's already created.
    perhaps you're not wording your question correctly.
  • Options
    LeroyLeroy Member Posts: 199
    Thanks for reply. Sorry my english. I want that, when I close the form (with the item already created) and it detects that item finish in ING-A, it goes to a new item form to insert a new item.
    Thanks for help.
  • Options
    SavatageSavatage Member Posts: 7,142
    Ok so you're entering an item and IF the item number ends in *ING-A you want and F3 (insert) to happen.
    This will allow you to enter another new item.

    Is this correct?
  • Options
    LeroyLeroy Member Posts: 199
    Yes!! it's correct. Is possible to do that?. I think I've to put the control on OnQueryCloseForm but I'm not sure, anyway I don't know how do the rest.
    Thanks for your help.
  • Options
    SavatageSavatage Member Posts: 7,142
    You'll have to explain why you want this,

    note if you do get this to work onquerycloseform (not to mention onNextRecord) everytime you enter & leave any item that contains ING-A you will be prompted to enter a new item everytime if you want to or not.
    If you use oninsert on the form you'll have to change the dlayed insert to yes. so i really think you should think this through on how you really want this to work.

    You could add a confirm (item contains ING-a would you like to create another item?) but all this seems like alot of work to avoid the simple F3

    if you need a simple reminder then
    varInteger := STRPOS("No.", 'ING-A');
    IF varInteger <> 0 THEN Message('Item %1 Contains ING-A',"No.");

    Sendkeys could invoke the F3 but i would really think about auto inserting new items in this manner
  • Options
    David_SingletonDavid_Singleton Member Posts: 5,479
    Leroy wrote:
    Yes!! it's correct. Is possible to do that?. I think I've to put the control on OnQueryCloseForm but I'm not sure, anyway I don't know how do the rest.
    Thanks for your help.

    What ever you are trying to do, it looks like you are going about it the wrong way.

    Take two steps back and start again and rep-hase the question by explaining why you are doing this and what you want to achieve, then maybe we can help you with a better solution.
    David Singleton
  • Options
    LeroyLeroy Member Posts: 199
    Thanks both for reply. The problem is that if I put the code on OnQueryCloseForm it shows me the message everytime that I get the item as you say;Is there any way that it shows only when I create it? How can I do a F3 sendkey automatically by code?, it will be after show the message.
    Respondig David I'll try to explain what I want to do. When an user insert a new reference ING-A terminated, I want that the system automatically forced to insert another Item which will be associated in another process. This is so because, the user who must link these two references, don't forget to create the associated Item; I hope to have explained. I can't think of another way to be sure that you insert the second reference.
    Thanks for help.
  • Options
    SavatageSavatage Member Posts: 7,142
    Are these items linked in some way?
    do they reference each other somewhere or have something in common?
    If so you can have the system check those/that field(s) to see if they filled, else make the item unusable.

    for exmaple if the item contains ING-A (onInsert) it sets the blocked field to true and onvalidate of the blocked field you can do a testfield to see if the "linked/reference" field is filled, then it will only allow you to uncheck the blocked field at that time.

    else I can't see this happening cleanly without putting the code oninsert and changing the delayedinsert proprty to yes on the item card. This way you won't be prompted to keep inserting everytime you enter this item as you will get using onqueryclose form.

    there are plenty of posts about sendkeys if you search the forum. but what's stopping the user from closing the form anyway once a new item insert has been created?

    if you want a message only then I can help you with that.
  • Options
    LeroyLeroy Member Posts: 199
    Thanks for reply; they are linked in other way, it's long to explain. With your comments and what I'll find seaching "sendkey" on forum it will be enough.
    Thank you very much for your help and time.
Sign In or Register to comment.