Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I have the following query field that compares different dates, and if the [CloseDate] is met before the [ExtDate] and/or [DueDate], returns a value of "0". This works fine. However, I need for it to return a value of "0" even in instances where none of the date fields have been entered. There are instance in this db where the dates are not needed, but I cannot leave the [Overdue] field null.

    Overdue: IIf([CloseDate]<Nz([ExtDate],[DueDate]),0,[CloseDate]-Nz([ExtDate],[DueDate]))

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this:

    Overdue: IIf(IsNull([Closedate]) and IsNull([ExtDate]) and IsNull([DueDate]),0,IIf([CloseDate]<Nz([ExtDate],[DueDate]),0,[CloseDate]-Nz([ExtDate],[DueDate])))

  3. #3
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you. That works perfect!

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    Quote Originally Posted by SmokeEater View Post
    I have the following query field that compares different dates, and if the [CloseDate] is met before the [ExtDate] and/or [DueDate], returns a value of "0". This works fine. However, I need for it to return a value of "0" even in instances where none of the date fields have been entered. There are instance in this db where the dates are not needed, but I cannot leave the [Overdue] field null.

    Overdue: IIf([CloseDate]<Nz([ExtDate],[DueDate]),0,[CloseDate]-Nz([ExtDate],[DueDate]))
    I know MBarron has solved tis for you but does your expression return Null, if so you could try:

    Overdue: Nz(IIf([CloseDate]<Nz([ExtDate],[DueDate]),0,[CloseDate]-Nz([ExtDate],[DueDate])),0)

Posting Permissions

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