Results 1 to 2 of 2
  1. #1
    BenM912 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    2

    Multiple account numbers

    Hey guys, just wondering if anyone could help me overcome this error. I have a sum that adds up all the Income and all the Expenditure a customer has. With these sums I then figure out the Disposable Income by subtracting Income by Expenditure. It seems to work, but when I change the record it retains the first expenditure value and removes it from the next persons income (which is wrong!). Here's the example:



    Customer 1 has a total income of £11,000 and an expenditure of £480. This calculates the DI to £10,520 (which is right).

    Customer 2 has no values in their income/expenditure boxes. When I add a type of income £10,000 (but no expenditure) and refresh the page it calculates the DI as £9,520 which is wrong! Now, the problem is this (what I think anyway). The code for my DI is this:

    SELECT TotalIncome.[Account Number], TotalIncome.SumOfAmountPaid, TotalExpend.SumOfExpenditureAmount, [SumOfAmountPaid]-[SumOfExpenditureAmount] AS SumOfDI
    FROM TotalIncome, TotalExpend
    GROUP BY TotalIncome.[Account Number], TotalIncome.SumOfAmountPaid, TotalExpend.SumOfExpenditureAmount, [SumOfAmountPaid]-[SumOfExpenditureAmount];

    Now, I know what the problem is, but I'm not too sure how to solve it. Basically I have two versions of the account number, the one in TotalIncome and the one in TotalExpend. However, as the account number in TotalExpend isn't being called, it's not associating the expenditure value to the account number. I tried using both but this just flags an error and doesn't calculate the DI.

    Anyone have any ideas on how to solve this?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I would expect the two tables/queries to be joined:

    FROM TotalIncome LEFT JOIN TotalExpend ON TotalIncome.[Account Number] = TotalExpend.[Account Number]

    In design view you'd accomplish that by clicking/dragging between the account number field in each table, creating a join line between them. If you right click on that line and edit the join, you'll see a description on the three possibilities.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Bank account catagories
    By broecher in forum Database Design
    Replies: 1
    Last Post: 10-16-2010, 10:21 PM
  2. Replies: 1
    Last Post: 07-18-2010, 03:35 PM
  3. Task Scheduler using Service Account
    By ExpertNovice in forum Access
    Replies: 2
    Last Post: 06-11-2010, 02:58 PM
  4. Newbie Help Account Numbers
    By Eric1066 in forum Access
    Replies: 3
    Last Post: 10-23-2009, 03:59 AM
  5. account rights
    By pietje in forum Security
    Replies: 1
    Last Post: 02-05-2009, 12:58 PM

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