[AccessD] report subheadings

Gustav Brock gustav at cactus.dk
Sat Jul 12 13:56:15 CDT 2003


Hi Susan

For a large recordset that method may be too slow ...

You could try to group by the date field only, setting the grouping
interval to "Week". If this groups on Sunday-Saturday, group by

  =[YourDateField]-1

Then, in your group header, use the DatePrevWeekday() function to
calculate the date of Monday.

/gustav


> Hi Susan

>>>   YourDateField
>>>     Ascending, no header or footer
>>>   =Format([YourDateField],"ww",2,2)
>>>     Ascending, header and/or footer

>> ==========Thanks Gustav, I'm already using this -- I thought it would help
>> me get where I wanted to go, but I haven't gotten there yet. :) What I'm
>> trying to do is return the full date of that week's Monday -- for instance,
>> July 16, is in the 29th week. I want to return July 14, 2003 -- the date of
>> the 29th week's Monday.

> Well, then this function could be for you!

> Change the sorting/grouping of the report to:

>    =DatePrevWeekday([YourDateField])
>      Ascending, header and/or footer
>    YourDateField
>      Ascending, no header or footer

> <code>

> Function DatePrevWeekday( _
>   ByVal datDate As Date, _
>   Optional ByVal bytWeekday As Byte = vbMonday) _
>   As Date

> ' Returns the date of the previous weekday, as
> ' spelled in vbXxxxday, prior to datDate.
> ' 2000-09-06. Cactus Data ApS.
    
>   ' No special error handling.
>   On Error Resume Next
  
>   DatePrevWeekday = DateAdd("d", 1 - WeekDay(datDate, bytWeekday), datDate)
    
> End Function

> </code>



More information about the AccessD mailing list