hi,
I have a report connected to a form where I can print the invoices between the two dates in the form but I have the problem:
when the checkbox = true refers to Canceled invoice but the values in this record still as it is, and I want to make the values equal zero if the checkbox = true, I tried hardly to make them equal zeros but the record disappeared from the report
I want to include the record within the report equal zero even it has a value in the query if the checkbox = true
I used this SQL Statement:
thanks in advance for any help you may provide me
I have a report connected to a form where I can print the invoices between the two dates in the form but I have the problem:
when the checkbox = true refers to Canceled invoice but the values in this record still as it is, and I want to make the values equal zero if the checkbox = true, I tried hardly to make them equal zeros but the record disappeared from the report
I want to include the record within the report equal zero even it has a value in the query if the checkbox = true
I used this SQL Statement:
Code:
SELECT tbl_SalesInvoices.InvoiceNo, tbl_SalesInvoices.Customer_ID, tbl_SalesInvoices.Date, CCur(Sum(nz(tbl_SalesInvoicesDetails.UnitPrice,0)*(nz(tbl_SalesInvoicesDetails.Quantity,0)))) AS Extended, CCur(Sum((nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))*10/100)) AS [Tax 10%], CCur(Sum((((nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))+(nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))*10/100)))) AS [Grand Total], tbl_Customer.CompanyName, tbl_SalesInvoices.Cancelled FROM (tbl_Customer INNER JOIN tbl_SalesInvoices ON tbl_Customer.CustomerID=tbl_SalesInvoices.Customer_ID) LEFT JOIN tbl_SalesInvoicesDetails ON tbl_SalesInvoices.InvoiceNo=tbl_SalesInvoicesDetails.InvoiceNo GROUP BY tbl_SalesInvoices.InvoiceNo, tbl_SalesInvoices.Customer_ID, tbl_SalesInvoices.Date, tbl_Customer.CompanyName, tbl_SalesInvoices.Cancelled, tbl_Customer.CustomerID HAVING (((tbl_SalesInvoices.Date) Between Forms![Search Sales Journal]!DF And Forms![Search Sales Journal]!DT) And ((CCur(Sum(nz(tbl_SalesInvoicesDetails.UnitPrice,0)*(nz(tbl_SalesInvoicesDetails.Quantity,0)))))=IIf(tbl_SalesInvoices.Cancelled=True,0,CCur(Sum(nz(tbl_SalesInvoicesDetails.UnitPrice,0)*(nz(tbl_SalesInvoicesDetails.Quantity,0)))))) And ((CCur(Sum((nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))*10/100)))=IIf(tbl_SalesInvoices.Cancelled=True,0,CCur(Sum((nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))*10/100)))) And ((CCur(Sum((((nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))+(nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))*10/100)))))=IIf(tbl_SalesInvoices.Cancelled=True,0,CCur(Sum((((nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))+(nz(tbl_SalesInvoicesDetails.UnitPrice,0)*nz(tbl_SalesInvoicesDetails.Quantity,0))*10/100))))))) ORDER BY tbl_SalesInvoices.InvoiceNo;
Comment