473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

make checkbox in report return Zero

mseo
181 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. 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
  2. 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
  3. GROUP BY tbl_SalesInvoices.InvoiceNo, tbl_SalesInvoices.Customer_ID, tbl_SalesInvoices.Date, tbl_Customer.CompanyName, tbl_SalesInvoices.Cancelled, tbl_Customer.CustomerID
  4. 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)))))))
  5. ORDER BY tbl_SalesInvoices.InvoiceNo;
thanks in advance for any help you may provide me
Jan 16 '10 #1
3 2656
nico5038
3,080 Recognized Expert Specialist
You'll need an IIF like:
Expand|Select|Wrap|Line Numbers
  1. IIF(tbl_SalesInvoices.Cancelled=True,0,CCur(Sum(nz(tbl_SalesInvoicesDetails.UnitPrice,0)*(nz(tbl_SalesInvoicesDetails.Quantity,0))))) AS Extended, ....etc
  2.  
Nic;o)
Jan 16 '10 #2
mseo
181 New Member
thank you
but this statement get the canceled record out of the report because when I check the checkbox in the form to cancel the invoice, I want to make it equal zeros in the report not to be disappeared
it is now 11 days looking for any solution for this problem
thank you
Jan 16 '10 #3
mseo
181 New Member
oh sorry
it is working like the charm this is the real best answer
I appreciate your replies
thank you very much
Jan 17 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
12275
by: Mark Anderson | last post by:
I'm getting a bit confused, it seems a checkbox object only has a length value if there is more than one checkbox of that name, 2 checkboxes named 'box' have a length of 2 but a single box returns...
4
26958
by: Piotr | last post by:
how can I read (in alert for example) array index number of checked checkbox? I have: <input type="checkbox" id="id_number" name="check" value="1" onclick="show()"/> <input type="checkbox"...
6
1936
by: Megan | last post by:
Hi everybody- I'm trying to use a checkbox to control whether or not a date field in a query "Is Null" or "Is Not Null." I have 2 date fields: InDate and OutDate. If there is an OutDate, then...
2
5431
by: CSDunn | last post by:
Hello, I have an Access 2003 report that opens in print preview and then maximizes upon clicking a button from a form. The OnClick event of the button fires a macro to open the report. How can...
12
6624
by: jkearns | last post by:
Hello, I made a report from a crosstab query following the steps onlined in MSDN's Solutions.mdb example. I now have a dynamic crosstab report (great!), but with one minor problem. I cannot get...
1
1455
by: Kapil Shah via DotNetMonster.com | last post by:
Hello Everybody, I am trying to write a crystal report function which should return a value of 1 for crystal report with no parameter and return a value 2 for crystal report with parameter. ...
4
5571
by: Steve | last post by:
Hi all, I don't want to use the datagrid if I don't have to. Is there a way to setup a ListBox to have more than one checkbox column? I need something like this | Include || Set as...
15
6474
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
5
10323
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.