472,995 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,995 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 1327
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:...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.