?
Solved

Weekly/Monthly Reports in Access

Posted on 2004-04-26
5
Medium Priority
?
3,932 Views
1 Endorsement
Last Modified: 2009-07-29
I need to create reports as follows:
Weekly reports all data should pull for the prior week
Monthly reports - all data should pull for the month that the user selects or enters

Could you give me ideas on the best way to do this?  I want it to be automated so they can just select a button - Prior week reports instead of having them enter dates from parameters with a between criteria query.  Thanks so much for your help!!
1
Comment
Question by:artgal
[X]
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
5 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10921404
when you say weekly, do you mean for the PAST 7 DAYS,no matter when the report is generated, or is this to be Monda through Friday of the week that ended LAST Friday (run on ANY day of the current week)

Same applies to Monthly (the past 30 days), or 1st of Month through End of Month for LAST Month.

AW
0
 

Author Comment

by:artgal
ID: 10921442
I mean it to be a Monday through Friday of the week that ended Last Friday run on Any day of the current week.

Same for Monthly ... 1st of the Month through End of Month for Last month.  

Thanks!
0
 

Expert Comment

by:Vellenaweth
ID: 10921677
Ok, you can do a Master query with a Form. In the form you can put a field which is used as a criteria in the query so it knows if the user wants a Week Report or a Month report.
Lets suppose you use a multiple choice box (I'm sorry English is not my first language and I'm not sure of the technical translation of some of Access objects to English), where 1 is the value for week and 2 is the value for month. Let's suppose you name that field ReportDateFormat
switch(ReportDateFormat=1,cstr(format(DateToBeFormated, "ww / yy")),ReportDateFormat=2,cstr(format(DateToBeFormated, "mm / yy")))

It is important to apply the Cstr because in case you want to be Cross Queries, it won't be able to do it unless you convert the Date to String.

0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10922057
for the Weekly report:

base it on this query:

Select * from YourTable where Format(YourDateField, "ww/yy") = Format(DateAdd("ww",-1,Date()),"ww/yyyy")

make the necessary changes to table name and field names.

similarly for the Last Month report:

Select * from YourTable where WHERE (((YourDateField,"mm/yyyy"))=Format(DateAdd("m",-1,Date()),"mm/yyyy")))

AW
0
 
LVL 6

Accepted Solution

by:
nathaniel earned 1000 total points
ID: 10924552
Hi artgal, here's another idea:


say you have table as : tbl_Transaction
and fields as              : transID, transType, transDate, transAmount


Here are the following reports you may create using Access' Query
(I assume you are already familiar in creating Queries)


Query1: Daily Transactions Summary Report for the Month of February
----------------------------------------------------------------------------------
(Copy-Paste in Query Design -> SQL view)

SELECT Format([transDate],"mmm-dd-yyyy") AS DailyReportForTheMonth, Sum(tbl_Transaction.transAmount) AS SumOftransAmount
FROM tbl_Transaction
WHERE (((Month([transDate]))=2))
GROUP BY Format([transDate],"mmm-dd-yyyy");

Note:
You can ask Month from users by changing WHERE to:
WHERE (((Month([transDate]))=[Enter Month: 1=Jan 2=Feb  12=Dec:]))



Query2: Weekly Transactions Summary Report as of Apr-9 (Cut-off)
------------------------------------------------------------------------------
(Copy-Paste in Query Design -> SQL view)

SELECT Format([transDate],"mmm-dd-yyyy") AS WeeklyReport, Sum(tbl_Transaction.transAmount) AS SumOftransAmount
FROM tbl_Transaction
WHERE (((tbl_Transaction.transDate) Between #4/5/2004# And #4/9/2004#))
GROUP BY Format([transDate],"mmm-dd-yyyy");

Note: above query is a fixed one but if you want your user to enter a cut-off date (say Mon-Friday, Friday is your cut-off day) then you need to create a visual basic function to further automate your query. If you're not ready with vb yet, then here's the other equivalent Queries.

In this example, we will need to create a subquery as follows:


SUBQUERY: To get cut-off date from user:
--------------------------------------------------
(Copy-Paste in Query Design -> SQL view)

SELECT tbl_Transaction.transDate, [Enter Cut-off date (Friday):] AS [Cut-Off], Sum(tbl_Transaction.transAmount) AS TotalAmount
FROM tbl_Transaction
WHERE (((tbl_Transaction.transDate)<=[Enter Cut-off date (Friday):]))
GROUP BY tbl_Transaction.transDate, [Enter Cut-off date (Friday):];

Note: don't run yet. here's the main Query to run..


QUERY2: A parameter query to generate Weekly Report based on User cut-off date:
------------------------------------------------------------------------------------------------
(Copy-Paste in Query Design -> SQL view)

SELECT SubQuery.transDate, SubQuery.[Cut-Off], Sum(SubQuery.TotalAmount) AS SumOfTotalAmount
FROM SubQuery
WHERE (((DateDiff("d",[transdate],[cut-off]))<8))
GROUP BY SubQuery.transDate, SubQuery.[Cut-Off];


Hope my examples above gave you an idea.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

764 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