date calculated from a fixed date and a number of days (1 Viewer)

Charlie G

New member
Local time
Today, 14:57
Joined
Nov 10, 2019
Messages
5
HI all,

trying to find a way to automatically calculate a table entry based on a known, set date (DateReceived field) plus a choosable number from a list (CheckInterval field - choice between 30, 45 and 60 days) and the calculated value automatically entered into a "CheckDue" field for that record

Example would be a received date of 1st November 2019 with a 45 day interval before a status check has to be made.

Aim is to later run a report showing which documents are either due or overdue for checking based on the current date compared to the "CheckDue" date (will cross that bridge much later though)

Thought the DateAdd function might work, but it is not working as hoped (not working at all!)

huge thanks in advance
 

plog

Banishment Pending
Local time
Today, 08:57
Joined
May 11, 2011
Messages
11,638
Thought the DateAdd function might work, but it is not working as hoped (not working at all!

DateAdd is indeed the way to go. Can you demonstrate how it is not working for you?
 

Hank.School

Registered User.
Local time
Today, 09:57
Joined
Oct 14, 2016
Messages
39
Generally you don't store calculated fields but to calculate your new date, you simply:


DateAdd("d", 45, "11/1/2019")


or try


DateAdd("d", [CheckInterval], [DateReceived])


What are you getting from the DateAdd function that isn't working?
 

Charlie G

New member
Local time
Today, 14:57
Joined
Nov 10, 2019
Messages
5
not getting a result as it will not allow me to add the DataAdd expression to a calculated field. It may be that I am using the wrong data type for the expression but not spotted which it should be to allow an expression to be added
 

plog

Banishment Pending
Local time
Today, 08:57
Joined
May 11, 2011
Messages
11,638
not getting a result as it will not allow me to add the DataAdd expression to a calculated field.

That doesn't make sense. You should be able to manually type anything into a new field box in the query designer.

Can you post your SQL to demonstrate what you have?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:57
Joined
Oct 29, 2018
Messages
21,449
not getting a result as it will not allow me to add the DataAdd expression to a calculated field. It may be that I am using the wrong data type for the expression but not spotted which it should be to allow an expression to be added
Hi Charlie. It sounds like you're trying to create a Calculated Field in the table. If so, you could just add the number to the date field. For example:


[DateFieldName]+45


Or, if the number is another field in the same table, then maybe something like:


[DateFieldName]+[OtherFieldNameHere]
 

Users who are viewing this thread

Top Bottom