Solved

Data calc

Posted on 2000-05-09
4
185 Views
Last Modified: 2010-05-02
I need to take a date inputed by the user and substract that date up to 24 months.  The Database has the dates as 01/01/00, we were planning to enter it the same way.  But I am open the requirement is to be able to take the end date the user input and subtract up to 24 months for the start dated of the search.  So what I am looking for is ideas to achive this in code.
0
Comment
Question by:akeyes
  • 3
4 Comments
 
LVL 14

Expert Comment

by:mcrider
ID: 2792577
Using the DateAdd function, you can add and subtract time intervals from dates...

For example, this adds 1 month to now:   dateadd("m",1,now)

This subtracts 1 month from now:  dateadd("m",-1,now)


Cheers!®©
0
 
LVL 14

Accepted Solution

by:
mcrider earned 100 total points
ID: 2792602
You can also do this:

x=dateadd("m",-24,"01/01/00") 'will return the date 1/1/98

Cheers!®©
0
 

Author Comment

by:akeyes
ID: 2800936
Thank you, I knew it was something simple.  I just could not for the life of me find it.
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2803109
Thanks for the points! Glad I could help!


Cheers!®©
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

756 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