pdvsa
asked on
Dateadd
Experts,
How would I add 4 months to [ValueDateDD]
[ValueDateDD]=DLookUp("Val ueDate","t blDraws_De tails1","I D = " & [DrawIDrpmt])
add 4 months:
=[ValueDateDD]+DateAdd("m" ,4,DLookUp ("ValueDat e","tblDra ws_Details 1","ID = " & [DrawIDrpmt]))
=[ValueDateDD]+DateAdd("m" ,4,[ValueD ateDD])
both of those add many years and not 4 months.
How would I add 4 months to [ValueDateDD]
[ValueDateDD]=DLookUp("Val
add 4 months:
=[ValueDateDD]+DateAdd("m"
=[ValueDateDD]+DateAdd("m"
both of those add many years and not 4 months.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your error is that you add ValueDate to itself plus four months.
That, of course, results in a date about 2016 + (2016 - 1899) = about 2136.
So your first expression is correct - just leave out [ValueDateDD]:
=DateAdd("m",4,DLookUp("Va lueDate"," tblDraws_D etails1"," ID = " & [DrawIDrpmt] & ""))
However, if [ValueDateDD] holds the same value as you would look up - which I suspect it does - it is even simpler, as in your second expression:
=DateAdd("m",4,[ValueDateD D])
So, as Rey would know if he had had his morning coffee, no need for a deroute via DateSerial.
/gustav
That, of course, results in a date about 2016 + (2016 - 1899) = about 2136.
So your first expression is correct - just leave out [ValueDateDD]:
=DateAdd("m",4,DLookUp("Va
However, if [ValueDateDD] holds the same value as you would look up - which I suspect it does - it is even simpler, as in your second expression:
=DateAdd("m",4,[ValueDateD
So, as Rey would know if he had had his morning coffee, no need for a deroute via DateSerial.
/gustav
ASKER