Form Date Less 12 Months

automationamateur

Board Regular
Joined
Jan 3, 2011
Messages
166
I have a query whose date parameter comes from a form. The form has an 'end date' control to run a trailing twelve month report. I want the query to pull data between the end date on the form and twelve months prior. My criteria is below, the first part with the "-12" is not working. I don't want to use a start date on the form to get around this. Please advise. Thanks!


Code:
Between [Forms]![frmMarginBucketReportFilter]![EndDate]-12 And [Forms]![frmMarginBucketReportFilter]![EndDate]
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
The formula, as you have written it, would only subtract 12 DAYS, not 12 MONTHS.

To do 12 months, use the DATEADD function, i.e.
Code:
Between DateAdd("m",-12,[Forms]![frmMarginBucketReportFilter]![EndDate]) And [Forms]![frmMarginBucketReportFilter]![EndDate]
 
Upvote 0

Forum statistics

Threads
1,206,830
Messages
6,075,109
Members
446,122
Latest member
sambee66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top