Results 1 to 4 of 4
  1. #1
    rbiggs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    23

    Sum Field


    I have two tables (Invoice and AddCharge) they are joined on the invoice number. My problem is I am trying to create a query that will have a Total Charge per invoice. Some just have a fee on the invoice while others have a fee on the invoice and one in the Addcharge table. When I try and add the amounts together I get an error since not every invoice # is in the AddCharge table. How can I skip the Addcharge table if the given Invoice does not exist?

    Thanks

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    You may have to change your join to a LEFT from an INNER. To be sure, suggest you post your SQL statement for your query.

  3. #3
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Answer depends on how you are adding. Here's a guess.

    [QUOTE=rbiggs;86593]I have two tables (Invoice and AddCharge) they are joined on the invoice number. My problem is I am trying to create a query that will have a Total Charge per invoice. Some just have a fee on the invoice while others have a fee on the invoice and one in the Addcharge table. When I try and add the amounts together I get an error


    If you have a query on the AddCharge table, you can create a calculated variable
    Var:Nz(AddChargeFee,0) and then use that to calculate the sum.
    If you are doing something with VBA, you need to use nz(var,0) to prevent trying to add a null value into the total.
    If you are doing something else, I'd like to hear about it.

  4. #4
    rbiggs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    23
    I used a combination of both. Thank you very much for your help.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-03-2011, 02:33 PM
  2. Replies: 1
    Last Post: 08-31-2011, 04:03 PM
  3. Replies: 7
    Last Post: 01-12-2011, 08:59 AM
  4. Replies: 9
    Last Post: 12-15-2010, 01:44 PM
  5. Replies: 3
    Last Post: 11-05-2010, 03:10 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