Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2011
    Posts
    66

    Unanswered: help!! How to ignore null value while using date function

    i have written a code to pick day , month, year from a field to 3 fields

    Private Sub Form_Current()
    Dim planyear As Integer
    Dim planmonth As Integer
    Dim planday As Integer

    planyear = YEAR([NEXT CAL DUE DATE])
    planmonth = Month([NEXT CAL DUE DATE])
    planday = Day([NEXT CAL DUE DATE])

    End sub

    but if NEXT CAL DUE DATE is a null value i get error how to correct and run code if it is null

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try:
    Code:
    If Not IsNull([NEXT CAL DUE DATE]) Then
        planyear = YEAR([NEXT CAL DUE DATE])
        planmonth = Month([NEXT CAL DUE DATE])
        planday = Day([NEXT CAL DUE DATE])
    End If
    Have a nice day!

  3. #3
    Join Date
    Sep 2011
    Posts
    66

    Thank you SINNDHO

    Thank you SINNDHO i got it working

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!

    PS. I don't forget what you asked me, I just need some time to prepare the answer.
    Have a nice day!

  5. #5
    Join Date
    Sep 2011
    Posts
    66

    Thank you SINNDHO thanks for the concern

    pls take your own time no problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •