Date field not under 1753 in Native

WaldoWaldo Posts: 3,493Member
edited 2007-11-23 in NAV Tips & Tricks
Source: My Blog.

Thanks to Kine's comment, I was able to create a somewhat workable solution.

It's quite simple. Just add following code at the beginning of the MakeDateText-function in Codeunit 1:

//*** Waldo BEGIN
  IF Date < 01011753D THEN BEGIN
    DateText := '';
    MESSAGE('Your Error Message');
//*** Waldo END

Off course, you can change the documentation lines .

It was a problem to raise the error in a proper way. I mean, when just raising the error, the message poped up at the proper time, but still, the value was filled in. As I didn't have the previous value of the field, I decided to empty the field, and then raising the error. Other solutions could be:

to switch the year to the current year
to work with a CONFIRM
to create some logic to propose the most probable date

Anyway, hope it's useful. :|

Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Sign In or Register to comment.