Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

YTD and Last Year to Date Calculations for Microsoft Access Reports 2

Status
Not open for further replies.

dgp2

Technical User
Nov 5, 2002
14
US
Could someone please help.
I have a report in MS Access2000 that shows me the number of call reports for a given company.

=DCount("LinkNumber","TblCallReportLog","LinkNumber = '" & [linknumber] & "'")

However, I would like to show the number of calls "Year to Date" (January 1st to the present day) and "Last Year To Date" (January 1st last year until the same date last year) without having to manually put in the dates.
 
dgp2,

One way could be to setup two totals queries with the date field and the calls, use the criteria: Between #12/31/2001# and date() for this year to date; and Between #12/31/2000# and #1/1/2002# Place text boxes with the appropriate items in your report.

Hope this helps.
 
Thanks bkpchs237 but I'm trying to avoid having to go and reset the dates every year. Also on the year to date last year would be for the same time period as year to date this year. For example YTD would be from 1/1/2002 - 11/6/02 and last year to date would be 1/1/2001 - 11/6/2001.
 
in the criteria...


>=&quot;1/1/&quot;&year(now()) and <=&quot;12/31/&quot;&year(now())

last year....

>=&quot;1/1/&quot;&year(now())-1 and <=&quot;12/31/&quot;&year(now())-1
 
Thanks ETID that was close but what I'm looking for is Year To Date (ie. January 1st-through todays date). and then Last Yeat To Date (would be January 1st last year - todays date minus 1 year). Any idea how I can incorporate the code you have to the code that's already there. I'm kind of a beginning programmer and I always get all kinds of errors. I appreciate your help.
 
This year.......

>=&quot;1/1/&quot;&year(now()) and <=now()

last year....

>=&quot;1/1/&quot;&year(now())-1 and <= day(now())&&quot;/&quot;&month(now())&year(now())-1
 
Thank you very much ETID. That's what I was looking for.
 
I am trying to use the Over All property on a Microsoft Access Report which provides daily information that spans over two years. The Report has headings Today, Month To Date and Year to Date. I use the over group property for the month to date information which works well, but when I go to the next year, the year to date cumulates all of the records in the datatbase. Is there any way I can correct my problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top