themastertaylor
Registered User.
- Local time
- Today, 13:59
- Joined
- Aug 8, 2007
- Messages
- 15
I received some help a while ago setting up a system whereby orders
placed and payments made were logged into a system to display the
remaining amount of credit with each supplier. for example if we have
a credit limit of £1000 orders totalling £7000 and £2000 is paid on
the account the credit remaining is displayed as £5000
i thought i had this working but today noticed a problem, the total
value of orders is working fine, however where there are multiple
orders with a supplier the payments are included as many times as
there are orders - i.e. if there are five orders with supplier a - a
payment of £200 is coming up as £1000.
the tables in use are named orders and payments. i have a query on the
orders table "nmorders" with a calculated value of quantity 1 x rate +
quantity 2 x rate2 etc for multiple items. the field is named value
and displays correctly. this is sorted by supplierid
on payments table i have a query to display payment ammount and
supplier id, again sorted by supplierid.
then i have a third query based on these queries and my orders table
called "nmordersquery". supplier id is taken from both queries,
payment amount is taken from nmpayments and value from nmorders. i
then have these figures summed with the following expression
respectively
Sum Of value: Sum(Nz(nmorders.value))
Sum Of Payment Amount: Sum(Nz(nmpayments.[Payment Amount]))
i also have a type 2 join between the queries and supplier table to
ensure all suppliers are included.
from this information can anybody work out how to stop the payments
being entered multiple times? by the looks of things each order has the supplier id in its data, as such when they are all summed the id is being picked up multiple times, the relationship seems to be transfering this to the payments table i.e. if supplier id is present 5 times in orders, each payment is being picked out 5 times. each individual query works fine its the query based on the other 2 thats causing the problem.
Thanks in advance
placed and payments made were logged into a system to display the
remaining amount of credit with each supplier. for example if we have
a credit limit of £1000 orders totalling £7000 and £2000 is paid on
the account the credit remaining is displayed as £5000
i thought i had this working but today noticed a problem, the total
value of orders is working fine, however where there are multiple
orders with a supplier the payments are included as many times as
there are orders - i.e. if there are five orders with supplier a - a
payment of £200 is coming up as £1000.
the tables in use are named orders and payments. i have a query on the
orders table "nmorders" with a calculated value of quantity 1 x rate +
quantity 2 x rate2 etc for multiple items. the field is named value
and displays correctly. this is sorted by supplierid
on payments table i have a query to display payment ammount and
supplier id, again sorted by supplierid.
then i have a third query based on these queries and my orders table
called "nmordersquery". supplier id is taken from both queries,
payment amount is taken from nmpayments and value from nmorders. i
then have these figures summed with the following expression
respectively
Sum Of value: Sum(Nz(nmorders.value))
Sum Of Payment Amount: Sum(Nz(nmpayments.[Payment Amount]))
i also have a type 2 join between the queries and supplier table to
ensure all suppliers are included.
from this information can anybody work out how to stop the payments
being entered multiple times? by the looks of things each order has the supplier id in its data, as such when they are all summed the id is being picked up multiple times, the relationship seems to be transfering this to the payments table i.e. if supplier id is present 5 times in orders, each payment is being picked out 5 times. each individual query works fine its the query based on the other 2 thats causing the problem.
Thanks in advance