title: User Defined Error for date
body: <p>How to validate an error for wrong date .
  I would to validate in leave trigger itself </p>
  
  <p>I used the following code, but not working :(</p>
  
  <p>can some one help .</p>
  
  <p>Thanksin advance.</p>
  
  <p>Regards,
  Ravi.
  dtJoin is a database field .</p>
  
  <p>Following is the code i tried .</p>
  
  <p>================================================</p>
  
  <pre><code>    DEFINE VARIABLE vDATE   AS DATE        NO-UNDO.
      DEFINE VARIABLE vToday  AS DATE        NO-UNDO.
  
      DEFINE VARIABLE leap    AS LOGICAL     NO-UNDO.
  
      ASSIGN
      vToday = DATE(DtJoin:SCREEN-VALUE) NO-ERROR.
  
      IF ((YEAR(vToday) MODULO 400 = 0)OR(year(vToday) MODULO 4 = 0)AND(year(vToday) MODULO 100 = 0) )
      THEN
          leap = TRUE.
      ELSE
          leap = FALSE.
  
          MESSAGE MONTH(vToday)
              VIEW-AS ALERT-BOX INFO BUTTONS OK.
          /* IF MONTH(vToday) = 1 /* OR MONTH(vToday) = 3 OR MONTH(vToday) = 5 OR MONTH(vToday) = 7 OR MONTH(vToday) = 8 OR MONTH(vToday) = 10 OR MONTH(vToday) = 12 */ THEN
      IF DATE(vToday) &gt; 31  THEN
         MESSAGE "Invalid Date"
             VIEW-AS ALERT-BOX ERROR BUTTONS OK.
      ELSE
        ASSIGN
        vdate = vToday.
     */
     /*
      ELSE IF MONTH(vToday) = 4 OR MONTH(vToday) = 6 OR MONTH(vToday) = 9 OR MONTH(vToday) = 11 THEN
      IF DATE(vToday) &gt; 30 THEN
         MESSAGE
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
      ELSE
        ASSIGN
        vdate = vToday.
  
      ELSE IF MONTH(vToday) = 2 AND leap THEN
          IF DATE(vToday) &gt; 29 THEN
             MESSAGE 
                 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
          ELSE
           ASSIGN
               vdate = vToday.
      ELSE 
          IF DATE(vToday) &gt; 28 THEN
              MESSAGE 
                  VIEW-AS ALERT-BOX ERROR BUTTONS OK.
          ELSE 
              ASSIGN
                  vDate = vToday.
                  */
      END.   
  </code></pre>