By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,504 Members | 2,606 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,504 IT Pros & Developers. It's quick & easy.

Append Query problem

P: n/a
I am running an append query using query by example (but included equivalent
SQL code). The query counts the number of bookings and appends this number
to bookings to Tbl_Weekly

INSERT INTO Tbl_Weekly ( NoofBooks, StartDate, EndDate )
SELECT Count(Bookings.DateofEvent) AS Noofbook, Forms!Printouts!WSdate AS
WeekStart, Forms!Printouts!WEdate AS WeekEnd
FROM Bookings
WHERE (((Bookings.DateofEvent)>[Forms]![Printouts]![WSdate] And
(Bookings.DateofEvent)<([Forms]![Printouts]![WEDate])))
GROUP BY Forms!Printouts!WSdate, Forms!Printouts!WEdate;

It works but...when the Count is 0 no record is appended. However I want to
append a zero count as well (ie 0,StartDate, EndDate). Any ideas?

Any help would be greatfully received
Regards
Geoff
Jan 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Geoff, what happens if you drop the GROUP BY clause?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Geoff" <gf****@freenetname.co.uk> wrote in message
news:fJ******************************@brightview.c om...
I am running an append query using query by example (but included
equivalent SQL code). The query counts the number of bookings and appends
this number to bookings to Tbl_Weekly

INSERT INTO Tbl_Weekly ( NoofBooks, StartDate, EndDate )
SELECT Count(Bookings.DateofEvent) AS Noofbook, Forms!Printouts!WSdate AS
WeekStart, Forms!Printouts!WEdate AS WeekEnd
FROM Bookings
WHERE (((Bookings.DateofEvent)>[Forms]![Printouts]![WSdate] And
(Bookings.DateofEvent)<([Forms]![Printouts]![WEDate])))
GROUP BY Forms!Printouts!WSdate, Forms!Printouts!WEdate;

It works but...when the Count is 0 no record is appended. However I want
to append a zero count as well (ie 0,StartDate, EndDate). Any ideas?

Any help would be greatfully received
Regards
Geoff

Jan 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.