By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,606 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

Reports

P: 19
hi,

I have a database in MS ACCESS 2000 in which I have a form with 6 fields. For this form I need to generate monthly and yearly reports. For the monthly reports I want to generate the report in such a way that when the user clicks for monthly option it should be able to give the month report for example if we want the report for january it should give the whole report for the january and if the user wants the report for january 2005 then it should generate the whole report for that particular month in that particular year. In this way I wanted to generate the report for all the 12 months for monthly report and for yearly report I should generate the reporst starting from the year 1991 to current year (like it may 2007/2008........ till future)................I hope I am clear with what I want.
Dec 5 '06 #1
Share this Question
Share on Google+
2 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
You need to design your report with the same record source as your form and then in the report open code you need to set criteria.

For example to get report to print records only for last month (for this example I am calling your date field EventDate as you didn't give a name):

Expand|Select|Wrap|Line Numbers
  1. Dim stLinkCriteria As String
  2.  
  3.    stLinkCriteria = "Month([EventDate])=" & Month(Now())-1
  4.    DoCmd.OpenReport "ReportName", , , stLinkCriteria
  5.  
  6.  
hi,

I have a database in MS ACCESS 2000 in which I have a form with 6 fields. For this form I need to generate monthly and yearly reports. For the monthly reports I want to generate the report in such a way that when the user clicks for monthly option it should be able to give the month report for example if we want the report for january it should give the whole report for the january and if the user wants the report for january 2005 then it should generate the whole report for that particular month in that particular year. In this way I wanted to generate the report for all the 12 months for monthly report and for yearly report I should generate the reporst starting from the year 1991 to current year (like it may 2007/2008........ till future)................I hope I am clear with what I want.
Dec 5 '06 #2

NeoPa
Expert Mod 15k+
P: 31,660
In the OnOpen event of the report you can do all sorts of things to affect how the report works.
Another problem here though is accessing the information that the caller knows (IE. which month / year).
You can do this with a Public variable in a module (which should be visible to both caller and callee), or you can define a Function to handle setting and returning value(s).
Dec 5 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.