L
LeslieJ via AccessMonster.com
Hi,
Below is the SQL for a query that I have that sums how many documents were
issued to a department for a specific month. The users select the month and
year from a form via combo boxes (that way they cannot select more than one
month for a date range). Then I have hidden text boxes that get updated
after the combo boxes are chosen with the afterupdate procedure:
Me.txtStartDate = DateSerial(Year(Date), Me.cboMonth.Column(0), 1)
Me.txtEndDate = DateSerial(Year(Date), Me.cboMonth.Column(0) + 1, 0)
The query works as expected, and it shows each day of the month that a
department received a document and sums how many were received on that day.
I was curious to know if there is a way to have the query sum the totals for
the whole month, and not split it up by day?
So instead of seeing:
Date of Initial Issue| Department Abbr| Count
18 Jul 08 | Dept1 | 1
18 Jul 08 | Dept2 | 1
19 Jul 08 | Dept1 | 1
We would see:
Department Abbr| Count
Dept1 | 2
Dept2 | 1
Thanks for your help in advance.
SELECT [Document Version Information].[Date of Initial Issue], [Document
Holder Information].[Department Abbreviation], Count([Document Holder
Information].[Department Holder Identifier]) AS [Count]
FROM [Document Version Information] INNER JOIN ([Document Distribution
Information] INNER JOIN [Document Holder Information] ON [Document
Distribution Information].[Department Holders Abbreviations] = [Document
Holder Information].[Department Abbreviation]) ON [Document Version
Information].[Version Identifier] = [Document Distribution Information].
[Document Version ID]
GROUP BY [Document Version Information].[Date of Initial Issue], [Document
Holder Information].[Department Abbreviation]
HAVING ((([Document Version Information].[Date of Initial Issue]) Between
[Forms]![frmDan'sMonthly]![txtStartDate] And [Forms]![frmDan'sMonthly]!
[txtEndDate]))
ORDER BY [Document Version Information].[Date of Initial Issue], [Document
Holder Information].[Department Abbreviation];
Below is the SQL for a query that I have that sums how many documents were
issued to a department for a specific month. The users select the month and
year from a form via combo boxes (that way they cannot select more than one
month for a date range). Then I have hidden text boxes that get updated
after the combo boxes are chosen with the afterupdate procedure:
Me.txtStartDate = DateSerial(Year(Date), Me.cboMonth.Column(0), 1)
Me.txtEndDate = DateSerial(Year(Date), Me.cboMonth.Column(0) + 1, 0)
The query works as expected, and it shows each day of the month that a
department received a document and sums how many were received on that day.
I was curious to know if there is a way to have the query sum the totals for
the whole month, and not split it up by day?
So instead of seeing:
Date of Initial Issue| Department Abbr| Count
18 Jul 08 | Dept1 | 1
18 Jul 08 | Dept2 | 1
19 Jul 08 | Dept1 | 1
We would see:
Department Abbr| Count
Dept1 | 2
Dept2 | 1
Thanks for your help in advance.
SELECT [Document Version Information].[Date of Initial Issue], [Document
Holder Information].[Department Abbreviation], Count([Document Holder
Information].[Department Holder Identifier]) AS [Count]
FROM [Document Version Information] INNER JOIN ([Document Distribution
Information] INNER JOIN [Document Holder Information] ON [Document
Distribution Information].[Department Holders Abbreviations] = [Document
Holder Information].[Department Abbreviation]) ON [Document Version
Information].[Version Identifier] = [Document Distribution Information].
[Document Version ID]
GROUP BY [Document Version Information].[Date of Initial Issue], [Document
Holder Information].[Department Abbreviation]
HAVING ((([Document Version Information].[Date of Initial Issue]) Between
[Forms]![frmDan'sMonthly]![txtStartDate] And [Forms]![frmDan'sMonthly]!
[txtEndDate]))
ORDER BY [Document Version Information].[Date of Initial Issue], [Document
Holder Information].[Department Abbreviation];