Results 1 to 4 of 4
  1. #1
    luckysarea is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8

    Question Multiple Payment Instances

    Please help me identify my mistake:

    My db has 4 tables:

    Orders Table
    Order ID
    Order Date

    Order Details Table
    Order Details ID
    Quantity
    Rate




    Payments Table
    Payment ID
    Order ID
    Amount Received

    Here is the relationship between them:


    I'm using ORDERS and ORDER DETAILS (Two Tables) as a single order may have multiple products.

    Now i have made a query to Calculate BALANCE AMOUNT:


    In this query you see two records. In both the records ORDER DATE, QUANTITY, RATE, AMOUNT BILLED are same. But AMOUNT RECEIVED are different. This is because i have entered two part-payment records for a particular Order ID in the PAYMENTS Table.

    The problem is that the above query would double the AMOUNT BILLED (on summation). What should i do to correct this.

    Thankx in advance!

  2. #2
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    I think you'll need 2 summary queries...one order query grouped by order id with the total amount ordered. Then you'll need a payment query grouped by order id with the total payment amount. Finally, create another query and add these 2 summary queries as the tables. Join on order id.

  3. #3
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    one query oriented solution is to change the query to an aggregate query - the epsilon E symbol and group the duplicate fields...... but not sure that's really ideal either.

    depends a bit on your goal. In terms of creating a report - the normal subreport relationship of the payments will link to the order and so that order is not going to show twice.....

  4. #4
    luckysarea is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8

    Thumbs up Thanx

    Quote Originally Posted by kennejd View Post
    I think you'll need 2 summary queries...one order query grouped by order id with the total amount ordered. Then you'll need a payment query grouped by order id with the total payment amount. Finally, create another query and add these 2 summary queries as the tables. Join on order id.
    Hey Thanx!! I got the logic. My query is working fine now.

    Thank you NTC for trying to help me.
    Last edited by luckysarea; 04-21-2011 at 03:30 PM. Reason: missed to thank someone

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query Table for "*" and then Count all instances
    By Steven.Allman in forum Queries
    Replies: 14
    Last Post: 09-10-2010, 07:45 PM
  2. Replies: 2
    Last Post: 05-25-2010, 02:45 PM
  3. Client Payment History
    By GMatos78 in forum Access
    Replies: 4
    Last Post: 04-24-2010, 09:19 AM
  4. Replies: 5
    Last Post: 12-10-2009, 10:33 PM
  5. Replies: 1
    Last Post: 12-10-2009, 08:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums