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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine # of weeks and print page for each

Status
Not open for further replies.

TheWkndr

Programmer
May 1, 2002
67
US
We have a weekly one-page sales reporting sheet. Ideally, we would like to be able to input a beginning and end date, then have it print a page for each week with the dates populated.

ie - If our begdate was 10/1/03 (a Wednesday), page 1 would print 'for the week of 10/1/03 - 10/4/03'. Page two would print 'for the week of 10/5/03 - 10/11/03', and so on until the end date.

Thanks
 
Create a date range parameter.

Group by the date and select this section will be printed for each week, and repeat group header on each page (in case you spill over to more than one page for a week).

Next, Right click the group footer and select New Page After.

To display the week range, create a formula containing:
totext(minimum({Orders.Order Date},{Orders.Order Date}, "weekly")) +" - "+ totext(maximum({Orders.Order Date},{Orders.Order Date}, "weekly"))

If you do not have data with the beginning and ending date for that week range, the formula will adjust to whatever the minimum and maximum are that you have in the data. If you do not have data for a given week, you will NOT get a header at all.

If this is a problem, you'll have to work out an alternative, my generic suggestion is to always create a periods table for any reporting environment, this is standard fare in a Data Warehouse, and any though out reporting environment.

You can then select the period from the period table, and join your table(s) to the date in the period table, guaranteeing that you'll always get the dates you require.

There are more code intensive workarounds, let me know if you need one.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top