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

Sorting by week

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I have a report where I want to display a list of entries and sort them by week based on a date field. In the sorting and grouping menu, I have selected the date field and selected "Week" for the "Group On" field with the group interval set to 1.

I have two questions/issues:
1. Even though I have the sorting for this field to Ascending, the report displays the results in strange order. It's almost descending, but I can't figure out what's going on. This is the order it shows:

week 1:
3/16/02
3/15/02

week 2:
3/20/02
3/23/02
3/22/02
3/21/02
3/19/02
3/18/02
3/17/02


2. I would like to be able to display to the user

"Week 3/17/02 - 3/25/02" and then show the relevant entries. How can I obtain these start and end dates. I have tried to take my date field and just add 7 to it, but if I only have entries for Wednesday and Thursday of that week, then the starting date is Wednesday. Is there any way to find out what dates Access is using to determine the different weeks? Thanks!
 
striker,
One way to do this is to count the weeks and then reference the txtbox
=Format$([XDATEIN],"ww")
In the "Datein Header" will give you the Number of the weeks in a year.
then another txtbox in the dateheader
=[xdatein]
If this is in the same "section" as the Format$ it will give the Monday date of that week, to get the Friday date of the week just add 4. =[xdatein]+4
jim
 
Not sure how this would work, but for your situation, I would try this in the Group Header:

="Week " & Format$([XDATEIN],"ww") & ": " & Min([XDATEIN]) & " - " & Max([XDATEIN])

This will incorporate xaf294's Week number in addition to what you're looking for. Roy
aka BanditWk
Las Vegas, NV
roy@cccamerica.org
RLMBandit@aol.com (private)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top