Group by week with a space

T

Todd

I have an end user asking for a list of all records grouped by week. In
other words datasheet view of the records grouped by week with a space
between the group by. That way when copied and pasted into Excel the records
have a row between them (possibly a title ie Week June 1-7 etc.). I tried
asking for more information about what they wanted to do with this report but
not getting anywhere. I thought of a macro (in Excel) possibility but have
no experience with that. Any ideas would be appreciated.
 
K

KARL DEWEY

Here is one way using three queries. Use your table and field names.
QRY Todd ---
SELECT [Date Entered]-Format([Date Entered],"w")+2 AS Week, Test_1.[Asset
Affected], Test_1.[Specific Cause], "0" AS x
FROM Test_1
ORDER BY [Date Entered]-Format([Date Entered],"w")+2;

QRY Todd_1
SELECT Todd.Week, Null AS [Asset Affected], Null AS [Specific Cause], "1" AS x
FROM Todd
GROUP BY Todd.Week, Null, Null, "1";

QRY Todd_2
SELECT [Todd_1].[Week], [Todd_1].[Asset Affected], [Todd_1].[Specific
Cause], [Todd_1].[x]
FROM [Todd_1]
UNION ALL SELECT Todd.[Week], Todd.[Asset Affected], Todd.[Specific Cause],
Todd.[x]
FROM Todd;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top