?
Solved

Dateadd

Posted on 2016-11-19
3
Medium Priority
?
48 Views
Last Modified: 2016-11-19
Experts,

How would I add 4 months to [ValueDateDD]
[ValueDateDD]=DLookUp("ValueDate","tblDraws_Details1","ID = " & [DrawIDrpmt])

add 4 months:
=[ValueDateDD]+DateAdd("m",4,DLookUp("ValueDate","tblDraws_Details1","ID = " & [DrawIDrpmt]))
=[ValueDateDD]+DateAdd("m",4,[ValueDateDD])
both of those add many years and not 4 months.
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 41894085
try

[ValueDateDD]=DateSerial(Year([ValueDateDD]),Month([ValueDateDD])+4,Day([ValueDateDD]))
0
 

Author Closing Comment

by:pdvsa
ID: 41894091
nice.  thank you Rey..
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 41894120
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("ValueDate","tblDraws_Details1","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,[ValueDateDD])

So, as Rey would know if he had had his morning coffee, no need for a deroute via DateSerial.

/gustav
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question