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

help needed plz


i have 2 queries totaldues and totalPayments
totaldues has 2 fileds(custID (Group By)
amountDue(sum of all invoices dues)
and totalPayments consist of CustID(Group By) and Amount_Paid(sum of
all payment)

thses queries calculate total dues and total payments customer made.
then i have another query on the base of these 2 queries which is
called custGrandBalance and it consist of customerID,amountDue(which is
sum of all dues about this customer), Amount_Paid(sum of all payment),
TotalDues: ([SumOfamountDue]-[SumOfAmount_Paid])

this query brings me total dues for the customer. Now problem starts
here that if i have amountDue > 0 but amount_Paid is nothing that means
customer never made any payment then this query will show me blank
record. for some reason. but if i put any payment in payment table then
i see the result. can any one help why is that. If there is no record
in query totalPayemnts then it should be equal to 0 which is not
happening

Nov 23 '05 #1
5 1153
Your problem is in the nature of what's called an "inner join" - you are
probably linking the output from both queries via CustID, and by default the
Query Designer makes such joins "inner joins" ie. it only shows records where
there is an exact match in both of the queries. If there is a CustID in one
query but not in another - in your case, if someone has Dues owing but not
made any payments - they aren't going to appear.

To see those people, you need to change the inner join to an outer join - so
that it shows all of the records from one table, irrespective of whether they
have a match in the other table - and the records from the other table that
have matches in your first one. Outer joins can be Left Outer Joins or Right
Outer Joins, but that's just a matter of the order that you specify your
tables in. You can change the join type in Query Designer by right clicking
on the line that represents the join and choosing from the subsequent message
box.

Note that this outer join will show you all customers who have Dues and any
payments they may or may not have made. If there is the possibility of
customers making payments when they don't have anything due, the outer join
isn't going to show this. If this is possible, it gets a bit more complicated,
but is still possible.

Hope that helps.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200511/1
Nov 23 '05 #2
To calculate your payments, you might start off with looking the at
dsum function. Now with then look at the nz() function. Put the two
together, nz(dsum(field,table,criteria),0) So if there are no payments
made, then a zero shows up. Plus you can eliminate a query from you db.

Nov 25 '05 #3
is there any way if amount_paid has no value, when we run the query,
then we could put it equal to 0

Nov 25 '05 #4
On 24 Nov 2005 23:47:34 -0800, "khan" <ah******@gmail.com> wrote:
is there any way if amount_paid has no value, when we run the query,
then we could put it equal to 0


Yes. Look up help on the Nz() function.

mike

Nov 25 '05 #5

khan wrote:
is there any way if amount_paid has no value, when we run the query,
then we could put it equal to 0

I am assuming you are using a group query. =NZ([pmt],0) instead of
[pmt]

Nov 25 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
7
by: ChadDiesel | last post by:
Hello everyone, I'm having a problem with Access that I need some help with. The short version is, I want to print a list of parts and part quantities that belong to a certain part group---One...
7
by: Tina | last post by:
I have an asp project that has 144 aspx/ascx pages, most with large code-behind files. Recently my dev box has been straining and taking long times to reneder the pages in the dev environment. ...
10
by: Mae Lim | last post by:
Dear all, I'm new to C# WebServices. I compile the WebService project it return no errors "Build: 1 succeeded, 0 failed, 0 skipped". Basically I have 2 WebMethod, when I try to invoke the...
2
by: trihanhcie | last post by:
I m currently working on a Unix server with a fedora 3 as an os My current version of mysql is 3.23.58. I'd like to upgrade the version to 5.0.18. After downloading from MYSQL.COM the package on...
2
by: Steve K | last post by:
I got a bit of a problem I like some help on. I'm designing an online training module for people that work in food processing plants. This is my target audience. These workers have little or no...
3
by: Kitana907 | last post by:
Hi- I'm attempting to write a module that uses and updates info from two tables and does the following: Opens the recordset of a table called "tblstoreinv" If the Needed Field in the...
9
by: smartbei | last post by:
Hello, I am a newbie with python, though I am having a lot of fun using it. Here is one of the excersizes I am trying to complete: the program is supposed to find the coin combination so that with...
2
by: rookiejavadude | last post by:
I'm have most of my java script done but can not figure out how to add a few buttons. I need to add a delete and add buttong to my existing java program. Not sure were to add it on how. Can anyone...
32
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.