473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

print cancelled invoices

mseo
181 100+
hi,
I have a report for printing sales journal and there are many invoices which cancelled or have no data and when I need to print a report all those invoices don't appear within the report i know that is because the invoice detail has no data so I used the nz function within the query but no thing has been changed
I need any help with this problem
thanks for any help you may provide me
Jan 12 '10 #1

✓ answered by nico5038

Try:
Expand|Select|Wrap|Line Numbers
  1. SELECT tbl_SalesInvoices.InvoiceNo, tbl_SalesInvoices.Customer_ID, tbl_SalesInvoices.Date, CCur(Sum(nz([UnitPrice],0)*(nz([Quantity],0)))) AS Extended, CCur(Sum((nz([UnitPrice],0)*nz([Quantity],0))*10/100)) AS [Tax 10%], CCur(Sum((((nz([UnitPrice],0)*nz([Quantity],0))+(nz([UnitPrice],0)*nz([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) RIGHT 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. ORDER BY tbl_SalesInvoices.InvoiceNo;
  5.  
I've changed an INNER JOIN into a RIGHT JOIN. I'm however never 100% sure or it needs to be a LEFT or RIGHT join, so you must check first in the query editor that an arrow is pointing from the tbl_SalesInvoices to tbl_SalesInvoicesDetails and not the other way around...

Nic;o)

4 1856
ChipR
1,287 Expert 1GB
Assuming your report is sourced directly on the query, what's the SQL for your query? Please use the [ code ] [ /code ] tags to make it readable.
Jan 12 '10 #2
nico5038
3,080 Expert 2GB
You should use a so-called "outer join" when linking to the details table.
Just double click (in the design mode of the query) the connection line between the tables (I assume the InvoiceID is the key/foreign key) and select the second or third option, making the Invoice the master table and the details the "slave".

Nic;o)
Jan 12 '10 #3
mseo
181 100+
the code I have used is
Expand|Select|Wrap|Line Numbers
  1. SELECT tbl_SalesInvoices.InvoiceNo, tbl_SalesInvoices.Customer_ID, tbl_SalesInvoices.Date, CCur(Sum(nz([UnitPrice],0)*(nz([Quantity],0)))) AS Extended, CCur(Sum((nz([UnitPrice],0)*nz([Quantity],0))*10/100)) AS [Tax 10%], CCur(Sum((((nz([UnitPrice],0)*nz([Quantity],0))+(nz([UnitPrice],0)*nz([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) INNER 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. ORDER BY tbl_SalesInvoices.InvoiceNo;
I just want print all the invoices even the invoice detail is null
thanks
Jan 13 '10 #4
nico5038
3,080 Expert 2GB
Try:
Expand|Select|Wrap|Line Numbers
  1. SELECT tbl_SalesInvoices.InvoiceNo, tbl_SalesInvoices.Customer_ID, tbl_SalesInvoices.Date, CCur(Sum(nz([UnitPrice],0)*(nz([Quantity],0)))) AS Extended, CCur(Sum((nz([UnitPrice],0)*nz([Quantity],0))*10/100)) AS [Tax 10%], CCur(Sum((((nz([UnitPrice],0)*nz([Quantity],0))+(nz([UnitPrice],0)*nz([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) RIGHT 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. ORDER BY tbl_SalesInvoices.InvoiceNo;
  5.  
I've changed an INNER JOIN into a RIGHT JOIN. I'm however never 100% sure or it needs to be a LEFT or RIGHT join, so you must check first in the query editor that an arrow is pointing from the tbl_SalesInvoices to tbl_SalesInvoicesDetails and not the other way around...

Nic;o)
Jan 13 '10 #5

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

Similar topics

5
by: Alan | last post by:
While not rs.eof <td><%=rs("InvoiceNo")%></td> <td><%=rs("Name")%></td> <td><a href="InvoicePrint.asp?WInv=<%=rs("InvoiceNo")%>"></a></td> <td>Print this invoice</td> rs.MoveNext Wend Now...
2
by: tom | last post by:
Hi, I have built an Access DB for a child care business. Family table stores the Family info. Room the different room names, capacity etc. Price stores the various price codes and amounts. The...
2
by: Sherwood Botsford | last post by:
I'm new to access. I have an orienteering database that has information about locations all over the map. Each location has 0-N clues I've worked up a report that will print the locations,...
9
by: StevenH | last post by:
I stumped Can someone assist me with the query for "invoices from 2002 & not from 2004" thanks
4
by: Das | last post by:
Hi All, I want to have a link on the web form. On click it should print the web form. If I use javascript window.print then it displays the Title on the top of the page & URL at the bottom but i...
1
by: Michael R | last post by:
I am using a PrintPreviewDialog to show a document. Via the BeginPrint event, I open a PrintDialog to let the user choose what pages (and other settings) to print. However, I can't find a way to...
6
by: Fresco | last post by:
Using Access 97, how do I avoid printing multiple copies of a check when the subreports used for the check stubs have multiple records (like when I want to pay several invoices with one check)? If I...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
9
by: Autostrad | last post by:
Hi everybody, I need your help. The code below is good if I want to print a sketch. The book did not show how to print a simple text file. Right now if I run this program (as is)it will show...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.