Results 1 to 3 of 3
  1. #1
    msacswt is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2016
    Location
    Cupertino, CA
    Posts
    5

    How to make Date shown under multiple condition?n

    Hi, Hopefully I may get solution form expert quickly.

    I need to show date based multiple condition. I have 4 dates: They are: Date 1 =>Project Days Late, Date 2=> Project due date, Date3=> Project extension date, Date 4=> Project closed date.

    The day Late on form needs to display under following condition:

    days late (Date 1) = today - project due date (Date 3) when there is no extension date ( Date2 is blank). If there is extension date ( Date 2 is not blank). Days Late = Today - extension date. But results need to be: show number of days if today is later than due date, otherwise it show " On Track".




    Really appreciate help

    Jim

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    build a custom function , then use it in a query.
    in the query call:
    select DueDateStatus([ProjDueDate]) as ProjectDue, DueDateStatus([ExtDate]) as ExtensionDate from table


    Paste this code into a module:
    Code:
    public function DueDateStatus(pvDueDate)
    if isNull(pvDueDate) then
           DueDateStatus= "no date set"
    else
      if Date() < pvDueDate then
          DueDateStatus="On Track"
      else
          DueDateStatus=Abs(DAteDiff("d",pvDate,Date()) & " days late"
      endif
    endif
    end function

  3. #3
    msacswt is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2016
    Location
    Cupertino, CA
    Posts
    5
    HI Ranman,

    Actually there are total 5 fields about Date.

    1) Open Date
    2) Due Date
    3) Extension Date
    4) Close Date
    5) Days Late

    Requirement:

    Due date = Open Date + 25 working days
    Days Late = today minus "Due Date" if "Extension Date" is blank, or today minus "Extension date" if "Extension Date" is not blank. If today minus the date>0, show actual number, otherwise show " On Track"

    It looks simple, but it is very challenging to me.


    It requires number or word on [Day Late] field.

    When [ExtensionDate] is blank:
    if today is later than [DueDate], [DayLate]=(today - [DueDate]),
    If [today is earlier than [DueDate] [DayLate] shows "ON Track"

    When [ExtensionDate] is not blank:
    If Today is later than [DueDae], [DayLate]= (Today -[DueDate]),
    If Today is earlier than [DueDate], [DayLate] = " ON Track"

    [DueDate]=([OpenDate]+25 business days)



    Many thanks !
    Last edited by msacswt; 06-17-2016 at 05:24 PM.

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

Similar Threads

  1. Select query with condition date later or equl to
    By robs23 in forum Programming
    Replies: 8
    Last Post: 12-20-2014, 02:02 PM
  2. Replies: 4
    Last Post: 10-16-2013, 01:05 PM
  3. Replies: 6
    Last Post: 07-29-2013, 05:05 AM
  4. DLookup with multiple field condition
    By agent- in forum Programming
    Replies: 4
    Last Post: 10-15-2011, 05:17 PM
  5. Open a report with a date condition
    By Grooz13 in forum Reports
    Replies: 3
    Last Post: 08-02-2010, 02:35 PM

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