Results 1 to 7 of 7
  1. #1
    gulaborani is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Posts
    3

    How to calculate the next due date using Calculated field or Query Criteria?

    Hello Everyone,

    I am fairly new to this forum and also Access database, so this question might seem really lame, but I really need some help here.

    Following is an example of table I am working with.

    ID Device Number 1st Cal Date 1st Due date 2nd Cal Date 2nd Due date Next Due Date after today
    1 1234 03/31/15 03/31/16 02/03/16 02/03/17
    2 4567 04/14/15 04/14/16 01/26/16 01/26/17
    3 7890 03/08/16 03/08/17


    I am trying to fill the column such that the next due date after "Today" within that row is displayed.


    For example in the first row it should be 02/03/17 and so on for the next rows.

    In excel the formula I use is (MIN(IF(ROW2Col3:Row2Col6)>Today()),Row2Col3:Row2C ol6)
    Pretty straight forward, but with access I am not entirely sure how to do the same.

    So far I have tried using the Calculated field using Date/Time, but I get an #ERROR.

    any help will be greatly appreciated.
    Thank You

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,466
    Not sure if I get what you are asking, what column are you looking to populate? All the Dute Dates values? Looks like you want to add time to a certain date? If so look at DateAdd function. So if you wanted to know the year after a date, it would be (changeYourdate to your date field):
    DueDate2 = DateAdd("yyyy", 1, YourDate)

  3. #3
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The structure of the table is like a spreadsheet - columns going off into the future. Each date combination should be on a different record:
    ID
    Device Number
    Cal Date
    Due Date

    Then in your query you take the max due date.

  4. #4
    gulaborani is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Posts
    3
    Thank You for your prompt reply.

    Correct me if I am wrong, but the DateAdd function will only add to one specific date?

    What I am looking for is not to add but to find from Column 3-Column 6 (1st Cal Date, 1st Due Date, 2nd Cal Date, 2nd Due Date) which one of these is the next date after today.

    How can we look up these 4 dates (Date1, Date2, Date3, Date4) which one is the next date after today?

    Does it make sense? I am so sorry for not being able to explain it better.


  5. #5
    gulaborani is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Posts
    3
    thank you aytee111 for replying back.

    SO if my table already have these 4 different columns, I need to separate them into 2 columns and create new record of the next 2 columns?
    I am not sure if I follow. Is there no way to just look up the date the way we see on a spreadsheet. Row2Col3:Row2Col6?

  6. #6
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In order to work in Access databases you have to think the opposite of spreadsheets! Spreadsheets are 2-dimensional, databases are 3-dimensional, a whole different concept. Access uses keys to get to records, so Row2Col3 will be primary key (when it is known) for the row number - record - and a real field name for the column.

  7. #7
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Further: you would have a query that used grouping (totals) and would group by device and take the max of the due dates - 1234/020317, etc. Another query would be a crosstab query to make it look like a spreadsheet and would include this first query which contains the field Next Due Date by device.

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

Similar Threads

  1. Replies: 7
    Last Post: 01-05-2016, 11:23 AM
  2. Replies: 3
    Last Post: 06-26-2015, 09:40 AM
  3. Replies: 3
    Last Post: 02-26-2015, 11:01 AM
  4. Replies: 5
    Last Post: 07-02-2014, 07:13 AM
  5. Setting criteria in a calculated date field
    By SteveReberger in forum Access
    Replies: 0
    Last Post: 10-29-2008, 06:58 AM

Tags for this Thread

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