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

nmedelec

New Member
Joined
Dec 14, 2016
Messages
1
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.

IDDevice Number1st Cal Date1st Due date2nd Cal Date2nd Due dateNext Due Date after today
1123403/31/1503/31/1602/03/1602/03/17
2456704/14/1504/14/1601/26/1601/26/17
3789003/08/1603/08/17

<tbody style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;">
</tbody>



I am trying to fill the last 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
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the Board!

The issue that you have is that you are working with a de-normalized database (meaning that the data design does not follow the best practice rule of relational database design - see: https://support.microsoft.com/en-us/kb/283878). Fields within a single record are really not supposed to be dependent on each other.

The MIN function in Access works against a single field across multiple records. You are trying to to perform a MIN against multiple fields in a single record. No such function exists.
So, if you want to do it, you have to write a formula to compare each field against the others. Since you have four fields, that is going to be a bit cumbersome. If I had no ability to change the structure of the data, I would probably create my own User Defined Function in VBA to do it, where you feed in the four fields, and then program it to do all the checks.
 
Upvote 0
Are you trying to add 1 year to the previous field? If so, you can use a query with:
DateAdd("y", 1, [2nd Due date]) as a field
 
Upvote 0

Forum statistics

Threads
1,221,780
Messages
6,161,888
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top