Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Function to find last 6 month from the current date

Posted on 2004-03-29
Medium Priority
Last Modified: 2012-05-04
Dear Experts,

I have a problem in finding the last 6 month from the current date.
the last 6 month from march 2004 are
Sep '03, Okt 03, Nov 03, Dec 03, Jan '04, and Feb '04.
are there anyone could help me how to make function for this problem in access.
Please Help...

Question by:fbachri
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
  • 4
LVL 65

Expert Comment

ID: 10702280
you could use the dateadd function

ie.  newDate = DateAdd("m",-6,now())

returns a date 6 months ago
LVL 65

Expert Comment

ID: 10702290
so to display the last 6 months (depending on what order you want, just change the loop)

dim i as byte

for i = 6 to 1 step -1
    debug.print "Date as of " & i & " months ago", dateAdd("m",i,now())
next i
LVL 65

Accepted Solution

rockiroads earned 400 total points
ID: 10702323
sorry, that should be


or you can just add the negative values in the loop (for i = -6 to -1)

Author Comment

ID: 10702709
LVL 65

Expert Comment

ID: 10702720
eh, no worries

just to let you know, there is an alternative, good for building dates


Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

604 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