Hi
I have a list box that is displaying a count for each productID on a given date. What I really need to do is also display if the count returned is '0'. here is the SQL for the two queries that create the listbox
Original count query:
SELECT First(PackageComponent.ProductID) AS [ProductID Field], Count(PackageComponent.ProductID) AS NumberOfDups, BookingHead.BookingDate, ProductDescription.GroupTypeID
FROM BookingHead LEFT JOIN (BookingDetail LEFT JOIN (ProductDescription RIGHT JOIN (BasicProduct RIGHT JOIN (ActivitiesBooked LEFT JOIN PackageComponent ON ActivitiesBooked.PackageID = PackageComponent.PackageID) ON BasicProduct.ProductID = PackageComponent.ProductID) ON ProductDescription.ProdDescID = BasicProduct.ProdDescID) ON BookingDetail.BookingDetailID = ActivitiesBooked.BookingDetailID) ON BookingHead.BookingHeadID = BookingDetail.BookingHeadID
GROUP BY BookingHead.BookingDate, ProductDescription.GroupTypeID, PackageComponent.ProductID, BookingDetail.Status
HAVING (((Count(PackageComponent.ProductID))>0) AND ((BookingDetail.Status)="booked"));
ListBox rowsource:
SELECT q_ProdIDCountBasedonDatePack.[ProductID Field], q_ProdIDCountBasedonDatePack.BookingDate, q_ProdIDCountBasedonDatePack.NumberOfDups
FROM q_ProdIDCountBasedonDatePack
WHERE (((q_ProdIDCountBasedonDatePack.[ProductID Field])=122 Or (q_ProdIDCountBasedonDatePack.[ProductID Field])=123) AND ((q_ProdIDCountBasedonDatePack.BookingDate)=[forms]![f_weemax].[cbodate]));
Both queries work as expected, but I just need to be able to display a '0' if no record counted.
thanks
jeremy
I have a list box that is displaying a count for each productID on a given date. What I really need to do is also display if the count returned is '0'. here is the SQL for the two queries that create the listbox
Original count query:
SELECT First(PackageComponent.ProductID) AS [ProductID Field], Count(PackageComponent.ProductID) AS NumberOfDups, BookingHead.BookingDate, ProductDescription.GroupTypeID
FROM BookingHead LEFT JOIN (BookingDetail LEFT JOIN (ProductDescription RIGHT JOIN (BasicProduct RIGHT JOIN (ActivitiesBooked LEFT JOIN PackageComponent ON ActivitiesBooked.PackageID = PackageComponent.PackageID) ON BasicProduct.ProductID = PackageComponent.ProductID) ON ProductDescription.ProdDescID = BasicProduct.ProdDescID) ON BookingDetail.BookingDetailID = ActivitiesBooked.BookingDetailID) ON BookingHead.BookingHeadID = BookingDetail.BookingHeadID
GROUP BY BookingHead.BookingDate, ProductDescription.GroupTypeID, PackageComponent.ProductID, BookingDetail.Status
HAVING (((Count(PackageComponent.ProductID))>0) AND ((BookingDetail.Status)="booked"));
ListBox rowsource:
SELECT q_ProdIDCountBasedonDatePack.[ProductID Field], q_ProdIDCountBasedonDatePack.BookingDate, q_ProdIDCountBasedonDatePack.NumberOfDups
FROM q_ProdIDCountBasedonDatePack
WHERE (((q_ProdIDCountBasedonDatePack.[ProductID Field])=122 Or (q_ProdIDCountBasedonDatePack.[ProductID Field])=123) AND ((q_ProdIDCountBasedonDatePack.BookingDate)=[forms]![f_weemax].[cbodate]));
Both queries work as expected, but I just need to be able to display a '0' if no record counted.
thanks
jeremy