A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

grouping issue with ' is not null '



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2010, 01:21 AM posted to microsoft.public.access.queries
trevorC via AccessMonster.com
external usenet poster
 
Posts: 37
Default grouping issue with ' is not null '

Hi All,
This first query all works fine, giving the expected results.
The second query is a copy of the first query and i changed the " IN " to "
OUT ", but this gives an error if the line ' HAVING (((gamrep.Out) Is Not
Null)) ' is missing. With this line in the query does work but the result is
no longer grouped as in the first query, the output is showing the entries
for each day for the week but not grouped as on entry and one total.

Both Queries show the first and last date of each week and a total Quantity

Can you help?

********First Query - Received Date *********************

SELECT
Format(DateAdd("d",-DatePart("w",[gamrep]![in],1)+2,[gamrep]![in]),"dd mmm
yyyy") AS [Start of Week],
Format(DateAdd("d",-DatePart("w",[gamrep]![in],1)+6,[gamrep]![in]),"dd mmm
yyyy") AS [End of Week],
Count(*) AS [Received Qty]
FROM gamrep

GROUP BY
DateAdd("d",-DatePart("w",[gamrep]![in],1)+2,[gamrep]![in]),
DateAdd("d",-DatePart("w",[gamrep]![in],1)+6,[gamrep]![in])

ORDER BY
DateAdd("d",-DatePart("w",[gamrep]![in],1)+2,
[gamrep]![in]) DESC;

********Second Query - Dispatch Date *********************

SELECT
Format(DateAdd("d",-DatePart("w",[gamrep]![out],1)+2,[gamrep]![out]),"dd mmm
yyyy") AS [Start of Week],
Format(DateAdd("d",-DatePart("w",[gamrep]![out],1)+6,[gamrep]![out]),"dd mmm
yyyy") AS [End of Week],
Count(*) AS [Completed Qty]
FROM gamrep

GROUP BY
DateAdd("d",-DatePart("w",[gamrep]![out],1)+2,[gamrep]![out]),
DateAdd("d",-DatePart("w",[gamrep]![out],1)+6,[gamrep]![out]),
gamrep.Out

HAVING (((gamrep.Out) Is Not Null))
ORDER BY
DateAdd("d",-DatePart("w",[gamrep]![out],1)+2,
[gamrep]![out]) DESC;

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201005/1

  #2  
Old May 5th, 2010, 04:41 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default grouping issue with ' is not null '

trevorC via AccessMonster.com wrote:
This first query all works fine, giving the expected results.
The second query is a copy of the first query and i changed the " IN " to "
OUT ", but this gives an error if the line ' HAVING (((gamrep.Out) Is Not
Null)) ' is missing. With this line in the query does work but the result is
no longer grouped as in the first query, the output is showing the entries
for each day for the week but not grouped as on entry and one total.

Both Queries show the first and last date of each week and a total Quantity

Can you help?

********First Query - Received Date *********************

SELECT
Format(DateAdd("d",-DatePart("w",[gamrep]![in],1)+2,[gamrep]![in]),"dd mmm
yyyy") AS [Start of Week],
Format(DateAdd("d",-DatePart("w",[gamrep]![in],1)+6,[gamrep]![in]),"dd mmm
yyyy") AS [End of Week],
Count(*) AS [Received Qty]
FROM gamrep

GROUP BY
DateAdd("d",-DatePart("w",[gamrep]![in],1)+2,[gamrep]![in]),
DateAdd("d",-DatePart("w",[gamrep]![in],1)+6,[gamrep]![in])

ORDER BY
DateAdd("d",-DatePart("w",[gamrep]![in],1)+2,
[gamrep]![in]) DESC;

********Second Query - Dispatch Date *********************

SELECT
Format(DateAdd("d",-DatePart("w",[gamrep]![out],1)+2,[gamrep]![out]),"dd mmm
yyyy") AS [Start of Week],
Format(DateAdd("d",-DatePart("w",[gamrep]![out],1)+6,[gamrep]![out]),"dd mmm
yyyy") AS [End of Week],
Count(*) AS [Completed Qty]
FROM gamrep

GROUP BY
DateAdd("d",-DatePart("w",[gamrep]![out],1)+2,[gamrep]![out]),
DateAdd("d",-DatePart("w",[gamrep]![out],1)+6,[gamrep]![out]),
gamrep.Out

HAVING (((gamrep.Out) Is Not Null))
ORDER BY
DateAdd("d",-DatePart("w",[gamrep]![out],1)+2,
[gamrep]![out]) DESC;



Why are you still using the Format function?

That HAVING should be WHERE.

--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.