Insert a new item on accept the message

LeroyLeroy Member Posts: 199
Dear sirs, on InsertRecord from Item form I've a control that detects if a new item contains -A it automatically shows a message and inserts another item.

itemprob := STRPOS("No.", '-A');
IF itemprob <>0 THEN
MESSAGE('Now you will enter a new item');
CREATE(WshShell);
WshShell.SendKeys('{F3}');

It runs me well. Just only I want that insert the new item when I acept the message, not after or before. I don't want to use a "if confirm". It's posible?.
Thanks in advance.

Comments

  • kapamaroukapamarou Member Posts: 1,152
    Please describe more your logic. What are you trying to achieve?

    I don't understand why you use Sendkeys and not a record variable. :?:
  • LeroyLeroy Member Posts: 199
    Thanks for reply. When I'm introducing a new item the code detects if the item contains "-A" caracteres. If is like this shows a message and automatically insert another item. It runs me well. Simply I want that it insert another item when I accept the message, not before or after.
    Thanks for help.
  • kapamaroukapamarou Member Posts: 1,152
    Leroy wrote:
    Simply I want that it insert another item when I accept the message, not before or after.

    If it is not before or after then when will it occur?
  • LeroyLeroy Member Posts: 199
    After of accept the message.
    Thanks.
  • kapamaroukapamarou Member Posts: 1,152
    I don't quite get it... :-k

    If you use MESSAGE the command will execute immediately. If you want to wait until confirmation you need to use CONFIRM (or some other dialog). What if the user decides to fill the item no. and go smoke a cigarette? You will need to manage the transaction with some commit in order to avoid blocking the table.


    Can you explain the meaning of -A? Maybe what you are trying to achieve can be implemented in another way...
  • LeroyLeroy Member Posts: 199
    Thanks for reply; if the only way is to use CONFIRM then it doesn't useful. I'll use SLEEP before show the message.
    Thanks for your help and time.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Well I guess it's good to start the day with a good joke. :mrgreen:

    I mean; I assume this is a joke right? :-k
    David Singleton
  • DenSterDenSter Member Posts: 8,305
    Well I guess it's good to start the day with a good joke. :mrgreen:

    I mean; I assume this is a joke right? :-k
    I doubt that it's a joke, but it sure is funny :mrgreen:
  • LeroyLeroy Member Posts: 199
    David Singleton wrote:
    Well I guess it's good to start the day with a good joke.

    I mean; I assume this is a joke right?

    I doubt that it's a joke, but it sure is funny

    :shock: Sorry?, I don't understand...
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Leroy wrote:
    :shock: Sorry?, I don't understand...

    Exactly and if you don't understand, how can we be expected to understand the problem and help you. You need to explain the business need of what you are doing. The code you have written should all be simply deleted and thrown away.

    Explain the issue clearly and all will become clear.
    David Singleton
  • SavatageSavatage Member Posts: 7,142
    Why are you so against a confirm?
    How else would the system know if you want to add a new item or not?
    you even say "Simply I want that it insert another item when I accept the message, not before or after"
    How will you accept the message without a YES/No Choice?

    I know this has to do with your last post,
    viewtopic.php?f=23&t=34933
    but i still think a simple message reminder should be enough for the user.
    Auto Inserting Items can only be problematic.
  • LeroyLeroy Member Posts: 199
    Sorry if there has been any misunderstanding, my english is not very good. I can't put a "confirm" because if the condition is true the introduction of a new item must be mandatory; if I put "confirm" the user can choose don't insert that new item, that is the reason.
    Simply wanted to appear the message and after press "Accept" insert the new item, but I thought it meant by your comment that it was not possible, that I had to use "confirm", but I can't for the reasons I have explained. Obviously there is a reason what I want to do it, but it will be very long to explain.
    I hope to have explained well.
    Thanks for help.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Leroy wrote:
    Sorry if there has been any misunderstanding, my english is not very good. I can't put a "confirm" because if the condition is true the introduction of a new item must be mandatory; if I put "confirm" the user can choose don't insert that new item, that is the reason.
    Simply wanted to appear the message and after press "Accept" insert the new item, but I thought it meant by your comment that it was not possible, that I had to use "confirm", but I can't for the reasons I have explained. Obviously there is a reason what I want to do it, but it will be very long to explain.
    I hope to have explained well.
    Thanks for help.


    Leroy, it has nothign to do with your language skills. We understand what you are trying to do. BUT we are saying that what you are doing is WRONG. You feel that we are saying that the code is wrong, but that is not the case. We are saying that the underlying business principles are wrong and that you need to go back to the client and rethink this in Navision terms.

    if you don't know how to do the business analysis then you need to get someone senior in the company to do this analysis. If there is no one senior enough to analyze such a simple requirement then your company should not be allowed to sell Navision.
    David Singleton
  • LeroyLeroy Member Posts: 199
    Thanks for reply. I'm not Navision seller, I'm final user, I implant solutions for my own company. I understand what you're trying to say and I appreciate your concern, don't do not misunderstand me; but believe me that it is only a small control that concern a very specific and unusual situation very long to explain and that has nothing to do with this.
    Thanks anyway for your help.
Sign In or Register to comment.