473,383 Members | 1,868 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,383 software developers and data experts.

Sum of balances for a repeating Invoice Number

77 64KB
Referencing post: -http://bytes.com/topic/access/answer...eating-invoice
I need some help with the calculation of invoice amounts on a Microsoft Access 2010 report. My report shows the following fields; -invoice#, invoice amount, payment amount, and payment due (i.e. payment due = payment amount - invoice amount). There are some invoice numbers have balances for their different regional offices:
for example:
Expand|Select|Wrap|Line Numbers
  1. Invoice#  Company  Site  InvoiceAmt   PmtAmt   PmtDue
  2. Invoice1     A          A1       2000            500        1500
  3. Invoice1     A          A2       4000           1000        3000
  4. Invoice 1    A          A3       1000           1000          0
  5. Invoice 2    B           B        3000           3000          0
  6.  
On my report, I would like to show two invoices on my report: - Company A has an Invoice1 with an Outstanding Balance $4,500 and Company B has an Invoice2 with an show total invoice amount is 0 (since it's only 2 invoices). I want to show this on my report. I was browsing around the internet and I came across a workaround method of doing this but it doesn't seem to be working for me. This is what I have done: -

I created a count query called qryPmtCount to count the number of invoice rows of each invoice based on my report's recordsource query: -
Expand|Select|Wrap|Line Numbers
  1. SELECT qryPayments.InvoiceNumber, Count(qryPayments.[InvoiceNumber]) AS N
  2. FROM qryPayments
  3. GROUP BY qryPayments.[InvoiceNumber];
  4.  
I created another new query called "qryPmtSum" in which I joined the "qryPmtCount" query to the original report query called qryPayments on the invoice number. I added all the fields from your original report query along with the count field, N, from the count query. Afterwards, I then changed the report's recordsource from your original query (qryPayments) to this new one.

In my report, I added the new count field N to the detail line, but setted its visible property to false (because I do not want to show how many invoice payments there are for that invoice). Finally, to get the true invoice value shown on each unbound invoice total, I changed the control source to: -
Expand|Select|Wrap|Line Numbers
  1. =SUM([PmtDue]/[N])
But the report is still not showing the expected results of only payment amounts for two invoice numbers: - Invoice1 and Invoice2. The report is still showing 4 line items: Invoice 1 repeating three times and Invoice 2 once.

Thank you in advance for your help
Sep 1 '15 #1

✓ answered by wirejp

Instead of using the approach described above, I used this query instead: -
Expand|Select|Wrap|Line Numbers
  1. SELECT qryPaymentPremiums.PremiumInvoiceNumber, qryPaymentPremiums.[ClientID], Sum(qryPaymentPremiums.NetPremiumAmt) AS SumOfNetPremiumAmt, Sum(qryPaymentPremiums.PremiumPmt) AS SumOfPremiumPmt, Sum([NetPremiumAmt]-[PremiumPmt]) AS PmtPrem
  2. FROM qryPaymentPremiums
  3. GROUP BY qryPaymentPremiums.PremiumInvoiceNumber, qryPaymentPremiums.[ClientID];

3 1372
wirejp
77 64KB
I got the issue resolved. Thanks
Sep 1 '15 #2
Rabbit
12,516 Expert Mod 8TB
Can you post your solution in case someone runs into the same problem?
Sep 2 '15 #3
wirejp
77 64KB
Instead of using the approach described above, I used this query instead: -
Expand|Select|Wrap|Line Numbers
  1. SELECT qryPaymentPremiums.PremiumInvoiceNumber, qryPaymentPremiums.[ClientID], Sum(qryPaymentPremiums.NetPremiumAmt) AS SumOfNetPremiumAmt, Sum(qryPaymentPremiums.PremiumPmt) AS SumOfPremiumPmt, Sum([NetPremiumAmt]-[PremiumPmt]) AS PmtPrem
  2. FROM qryPaymentPremiums
  3. GROUP BY qryPaymentPremiums.PremiumInvoiceNumber, qryPaymentPremiums.[ClientID];
Sep 2 '15 #4

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

Similar topics

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...
13
by: Ron | last post by:
Hi all I'm deciding whether to use the PK also as an account number, invoice number, transaction number, etc that the user will see for the respective files. I understand that sometimes a...
3
by: barkarlo | last post by:
how can I create input mask for invoice number for an example 07-08000-427 where 07-08000 is constant and 427 is changes. I would like write only number who is changes.
1
by: lctking | last post by:
on an Excel spread sheet I have 3 columns of data - in column 1 are invoice numbers, in column 2 are amounts, and in column 3 are descriptions of charges i.e salary,supplies, etc - every invoice can...
1
by: gobblegob | last post by:
Hi guys i am trying to randomize 6 numbers into 6 textboxes up to the value of 60 without repeating a number but i dont know how an error handler would work for duplicate numbers any idea's? this...
21
by: palanidharma | last post by:
hi all, i am new to php.how to generate invoice number (EX:INV2008001) this format. plz reply me the code.... thanks palani
6
by: ConfusedMay | last post by:
Hi I need some helps in calculating the invoice amount in access 2003 report. Basically I have an access report that shows invoice#, invoice amount, payment amount, and payment date. The problem is...
5
by: chrisbenett | last post by:
Hi all, I want to create an invoice number that looks like "YYMMDD01" which will increment with 1 for each invoice. But the next day, it will need to start at one again. Example: Today:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.