Results 1 to 4 of 4
  1. #1
    tom89 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2018
    Posts
    2

    Trouble with a countdown field expression which works off 2 potential fields using IIF

    Hello,



    Hope this is in the right forum!

    I'm trying to complete an unbound countdown TextBox called 'DaysToComplete. However there is not always going to be a value in one of the fields (ImplementationDate) when a value is present in the ImplementationDate field I need it to use this date, if not then I need the countdown to use the field (DueDate) The DueDate field will always be populated. The 'DaysToComplete' entry is always working from the present day.

    This was the expression we use and know works in Excel.

    =If([ImplementationDate]="",Int([DueDate]-Date()),Int([ImplementationDate]-Date()))


    We replaced the if with iif and put into access but no luck.


    This is the latest one I have tried and the records return as '#Name?' so a little bit stuck now.

    =IIf(IsNothing([Fields]![ImplementationDate].[Value]),DateDiff("d",Date(),[Fields]![DueDate].[Value]),DateDiff("d",Date(),[Fields]![ImplementationDate].[Value]))


    If anyone has any ideas where we're going wrong or even a new approach to give us the desired result that would be of huge help!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    not so in Access:

    =iIf(IsNull([ImplementationDate]),dateDiff("d",[DueDate],Date()),DateDiff("d",[ImplementationDate],Date()))

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Or maybe

    =DateDiff("d",Nz([ImplementationDate], [DueDate]), Date())
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    tom89 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2018
    Posts
    2
    Thanks a lot, that works perfectly.

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

Similar Threads

  1. Replies: 6
    Last Post: 06-30-2017, 10:46 AM
  2. Replies: 3
    Last Post: 04-15-2014, 10:07 AM
  3. Replies: 3
    Last Post: 09-13-2013, 04:17 PM
  4. Trouble with Expression
    By kctxucop08 in forum Access
    Replies: 1
    Last Post: 07-14-2011, 01:55 AM
  5. Expression trouble
    By ROB in forum Access
    Replies: 2
    Last Post: 06-08-2010, 09:36 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