Greetings!
I have a database that logs salesman activity by date. tblActMaster holds one record for each salesman / date combination, including the salesman name and the date. tblActDetail holds one record for each customer call for a given salesman and date. For this report we only need the master since the presence of a master record for a given salesman and date implies activity on that date.
I'm trying to write a report that groups the activity by salesman and calendar quarter, printing the actual dates in each quarter on which the salesman had activity. I've desinged the report based on a parameter query that restricts the records to be within one calendar year. The report should look something like the following:
HDR: Salesman QTR1 QTR2 QTR3 QTR4
DET: John Doe 1/1, 2/1 4/1 7/1 10/1, 11/1
The above would indicate that John Doe had activity on Jan 1, Feb 1, Apr 1, Jul 1, Oct 1, and Nov 1. Of course, the fields would be wider, and I plan to wrap the list of dates in each quarter. I'm using IIF statements to determine whether a date falls into a given quarter, like this:
QTR1: IIF([ActDate] between #01/01/2002# and #03/31/2002#, [ActDate],Null)
The final version won't have constants for the date range, I'll calculate the proper dates based on the calendar year. The problem I'm having is with the grouping. As soon as I turn grouping on in the query to group by the salesman, Access insists that I have a grouping function on the quarter fields. As near as I can tell, none of the grouping functions that work with dates (max, min, etc.) will do what I want. If all I wanted was to count the number of days that a salesman had activity or something similar, I'd be done by now. But I need to print the actual dates on which the activity occured. What I really need is some sort of concatenation grouping function that would let me build the list of dates via my IFF statement.
I've also tried to write this as a report running directly against tblActMaster instead of through a query, and can't figure out teh grouping there either. If I eliminate the grouping and print each record on it's own detail line, I can make that work. But I really need to print all of the dates for a salesman on one line.
Any ideas greatly appreciated!
Dale Beitz
I have a database that logs salesman activity by date. tblActMaster holds one record for each salesman / date combination, including the salesman name and the date. tblActDetail holds one record for each customer call for a given salesman and date. For this report we only need the master since the presence of a master record for a given salesman and date implies activity on that date.
I'm trying to write a report that groups the activity by salesman and calendar quarter, printing the actual dates in each quarter on which the salesman had activity. I've desinged the report based on a parameter query that restricts the records to be within one calendar year. The report should look something like the following:
HDR: Salesman QTR1 QTR2 QTR3 QTR4
DET: John Doe 1/1, 2/1 4/1 7/1 10/1, 11/1
The above would indicate that John Doe had activity on Jan 1, Feb 1, Apr 1, Jul 1, Oct 1, and Nov 1. Of course, the fields would be wider, and I plan to wrap the list of dates in each quarter. I'm using IIF statements to determine whether a date falls into a given quarter, like this:
QTR1: IIF([ActDate] between #01/01/2002# and #03/31/2002#, [ActDate],Null)
The final version won't have constants for the date range, I'll calculate the proper dates based on the calendar year. The problem I'm having is with the grouping. As soon as I turn grouping on in the query to group by the salesman, Access insists that I have a grouping function on the quarter fields. As near as I can tell, none of the grouping functions that work with dates (max, min, etc.) will do what I want. If all I wanted was to count the number of days that a salesman had activity or something similar, I'd be done by now. But I need to print the actual dates on which the activity occured. What I really need is some sort of concatenation grouping function that would let me build the list of dates via my IFF statement.
I've also tried to write this as a report running directly against tblActMaster instead of through a query, and can't figure out teh grouping there either. If I eliminate the grouping and print each record on it's own detail line, I can make that work. But I really need to print all of the dates for a salesman on one line.
Any ideas greatly appreciated!
Dale Beitz