Results 1 to 3 of 3
  1. #1
    DanW is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2009
    Posts
    30

    Null Date control code problem

    Hi and thanks for your help in advance.

    I have not been able to code for the condition of a null date control. I have a date control and an unbound text box with an expression that calculates the number of months since the date entered in the date control.

    I have been able to code for different effects on a form whether the calculated text box is below or above a number of months. But if the date and calculated controls are empty, I get the effects I wanted if the number in the calculated control was higher than my dividing line.

    I would like to have a different set of effects on the form if the date control is empty, but have tried everything I can think of to define that empty data state without success.

    This is what works now, where the Null state returns the Else effect.

    If Me.txtDateDiff <= 10 Then


    Code for Effect 1
    Else
    Code for Effect 2
    End If



    This is what I would like to have, but doesn't work.

    If Me.txtDate is Null Then
    Code for Effect 0
    ElseIf Me.txtDateDiff <= 10 Then
    Code for Effect 1
    Else
    Code for Effect 2
    End If

    What am I missing?

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    If IsNull(Me.txtDate)Then
    Code for Effect 0
    End If
    If Me.txtDateDiff <= 10 Then
    Code for Effect 1
    Else
    Code for Effect 2
    End If

  3. #3
    DanW is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2009
    Posts
    30
    That worked NTC
    Thanks for getting me past that.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Is null problem
    By rockape in forum Programming
    Replies: 5
    Last Post: 09-29-2009, 12:46 PM
  2. Date Problem
    By oldteddybear in forum Queries
    Replies: 1
    Last Post: 08-30-2009, 08:52 AM
  3. Problem with date field...
    By Rameez in forum Access
    Replies: 9
    Last Post: 06-23-2009, 10:29 AM
  4. problem in splitting Date and time fields
    By swaroop1012 in forum Queries
    Replies: 1
    Last Post: 11-22-2008, 11:29 AM
  5. Problem with Code
    By cujee75 in forum Programming
    Replies: 0
    Last Post: 03-10-2006, 02:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums