Year to date/ End Date Form

AJordan

Registered User.
Local time
Today, 09:38
Joined
Mar 25, 2008
Messages
73
I am trying have a calculated field which gives me the year to date amount of orders. I currently have a query which is set up to return the amount of orders Between user defined dates
Code:
Example 
Between [forms]![fmr1]![txtbegdate] AND [forms]![fmr1]![txtenddate]

Now this has worked fine but now I am interested in being able to know year to date information based on ([forms]![fmr1]![txtenddate] - 365)
What is the correct criteria for this?
 
I'm a little confused as to what you are actually trying to do, does the start date not come into this? Incidentally to subtract a year I would use Dateadd

Brian
 
now I am interested in being able to know year to date information based on ([forms]![fmr1]![txtenddate] - 365)
What is the correct criteria for this?

Actually the value of end date -365 wouldn't necessarily give you a year to date. If you really want a Year to Date then you would more likely want criteria of this:

Between DateSerial(Year(Date()), 1, 1) And Date()

Which would get you everything between January 1st of the current year and up to, and including, today.
 
If you want a ROLLING year then the DateAdd function like Brian suggested would be what you would use.
 
Actually the value of end date -365 wouldn't necessarily give you a year to date. If you really want a Year to Date then you would more likely want criteria of this:

Between DateSerial(Year(Date()), 1, 1) And Date()

Which would get you everything between January 1st of the current year and up to, and including, today.

Yes this is what I intend to do, I really dont know why I did the "-365" as an example. My only question would be if I could replace Date(), with a user defined date from a form.

The issue occurs when a user decides they want to do a monthly report for "April", but the run the report on May 5th. So my main concern is a user defined end date. Would this work?
Code:
Between DateSerial(Year(Date()), 1, 1) And [forms]![frmX]![txtEndDate]
 
yes it would give the data from the start of the year to the date on the form.

Brian
 
OK, thanks guys for your help. I will try this a little later to see if everyting goes smoothly
 

Users who are viewing this thread

Back
Top Bottom