A message is displayed two times when i open a form!!

hazemhazem Member Posts: 187
Hello everybody,
i want to display a message each time i get a record. I put the code dipsalying this message in the trigger OnAfterGetRecord() of the form. The problem is that the message is dispalyed two times when i run the form, if i go to another record the message is displayed only one time. What should be the problem?

Comments

  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    OnAfterCurrentRecord instead?
  • hazemhazem Member Posts: 187
    I got the same problem with OnAfterGetCurrRecord()
  • hazemhazem Member Posts: 187
    Really!!!!
    It's it a bug?There's no solution then :?
  • hazemhazem Member Posts: 187
    Thanks Blacktiger...So there's no solution!!!I'll try to add some code to display only once the message
  • krikikriki Member, Moderator Posts: 9,118
    In stead of just putting the message, you can use a global variable of the same record-type as the SourceTable of the form.
    If the current record is different from the one in the global variable, you give a message (and save the record in the global variable), otherwise no message.
    The code will be something like this:
    global variable recMyRecord AS record of table X.
    IF (recMyRecord."Primary key Field 1" <> "Primary key Field 1") OR
       (recMyRecord."Primary key Field 2" <> "Primary key Field 2") OR
       ... THEN BEGIN
      MESSAGE('Your Message');
      recMyRecord := rec;
    END;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • hazemhazem Member Posts: 187
    Thanks kriki, the problem of saving the message only once is solved. But still got another problem!!!If for example i reduce the window and open it again i got the message again!!!!!!
  • ajhvdbajhvdb Member Posts: 672
    Resizing columns will do the same.
  • krikikriki Member, Moderator Posts: 9,118
    hazem wrote:
    Thanks kriki, the problem of saving the message only once is solved. But still got another problem!!!If for example i reduce the window and open it again i got the message again!!!!!!
    This because in both cases, the screen is refreshed.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.