Hello! I am running into an issue that I hope someone can help me with. I am using NAV 2016. In my List page, I have added some code to validate that two fields match. If they do not match, the code gives the user a message letting them know that the two fields must match.
It is working fine accept that the message box pops up twice. The first time it opens, I select OK, and then it opens up a second time.
Here is the code:
Batch - OnValidate()
IF "Order Lines" <> "Lines Shipped" THEN BEGIN
MESSAGE('The number of Order Lines must Match the number of Lines Shipped');
"Ready for Batch" := FALSE;
CurrPage.UPDATE;
END;
Is there a way to make the code only run once?
Thanks in advance!
0
Answers
you dont need all other lines.
But you have to add one more condition before raising the error, like this:
Why do you need Currpage.Update?
When I changed the code to use the Error function, I no longer needed the rest of the code. It automatically unchecked the box.
to answer your question, I was using it with my original code to show that the checkbox was unchecked.