W
Winnetou
(Reformulated question based on an earlier post. Thanks to Duane
Hookom's hints!)
I have a query (qryActDay) that sorts activities by weekdays (Mon, ...,
Sun). Each weekday is either void or contains the first activity
recorded on that day. How can I create a query that would "add up" all
the weekday's activities to produce a single week record?
Current data (qryActDay):
ActDueDay Wk Mon Tue Wed Thu Fri Sat
Sun
02/27/06 09 Init PRJ1
03/01/06 09 Quote PRJ1
03/03/06 09 Specs PRJ2
03/07/06 10 Invc PRJ1
03/10/06 10 Init PRJ2
Desired output:
Wk Mon Tue Wed Thu Fri Sat Sun
09 Init PRJ1 Quote PRJ1 Specs PRJ2
10 Invc PRJ1 Init PRJ2
Thanks for any insights!
Mark
Query 'qryActDay':
SELECT tblAct.ActDueDay, CInt(DatePart("ww",[ActDueDay],2)) AS Wk,
First(IIf(Len([ActDesc])>5,Left([ActDesc],5) & "..",[ActDesc])) AS
ActDesc1, Weekday([ActDueDay]) AS WkDay, IIf([WkDay]=1,[ActDesc1],Null)
AS Sun, IIf([WkDay]=2,[ActDesc1],Null) AS Mon,
IIf([WkDay]=2,[ActDesc1],Null) AS Tue, IIf([WkDay]=3,[ActDesc1],Null)
AS Wed, IIf([WkDay]=4,[ActDesc1],Null) AS Thu,
IIf([WkDay]=6,[ActDesc1],Null) AS Fri, IIf([WkDay]=7,[ActDesc1],Null)
AS Sat
FROM tblAct
GROUP BY tblAct.ActDueDay
ORDER BY tblAct.ActDueDay;
Hookom's hints!)
I have a query (qryActDay) that sorts activities by weekdays (Mon, ...,
Sun). Each weekday is either void or contains the first activity
recorded on that day. How can I create a query that would "add up" all
the weekday's activities to produce a single week record?
Current data (qryActDay):
ActDueDay Wk Mon Tue Wed Thu Fri Sat
Sun
02/27/06 09 Init PRJ1
03/01/06 09 Quote PRJ1
03/03/06 09 Specs PRJ2
03/07/06 10 Invc PRJ1
03/10/06 10 Init PRJ2
Desired output:
Wk Mon Tue Wed Thu Fri Sat Sun
09 Init PRJ1 Quote PRJ1 Specs PRJ2
10 Invc PRJ1 Init PRJ2
Thanks for any insights!
Mark
Query 'qryActDay':
SELECT tblAct.ActDueDay, CInt(DatePart("ww",[ActDueDay],2)) AS Wk,
First(IIf(Len([ActDesc])>5,Left([ActDesc],5) & "..",[ActDesc])) AS
ActDesc1, Weekday([ActDueDay]) AS WkDay, IIf([WkDay]=1,[ActDesc1],Null)
AS Sun, IIf([WkDay]=2,[ActDesc1],Null) AS Mon,
IIf([WkDay]=2,[ActDesc1],Null) AS Tue, IIf([WkDay]=3,[ActDesc1],Null)
AS Wed, IIf([WkDay]=4,[ActDesc1],Null) AS Thu,
IIf([WkDay]=6,[ActDesc1],Null) AS Fri, IIf([WkDay]=7,[ActDesc1],Null)
AS Sat
FROM tblAct
GROUP BY tblAct.ActDueDay
ORDER BY tblAct.ActDueDay;