Results 1 to 4 of 4
  1. #1
    joannakf is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    11

    Query: Subtract totals from different tables

    I am writing a total query and I keep getting the error message that I am trying to execute a function without a specified expression.



    I have a table that says:
    BLDG Count of A
    1 1
    2 3
    3 1

    And a Query That says:
    BLDG Count of B
    1 1
    2 2

    How do I write an expression that subtracts Count of B from Count of A only when the BLDG matches but displayes all of the totals for the first table.

    Thanks in advance!!

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Show us the query

  3. #3
    joannakf is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    11
    I attached a screen shot of the query...thanks!

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You are trying to do too much at one time. Get each individual piece working one at a time.

    First, create a query showing all the buildings you want to see from the correct place (I think your join is the wrong way around). Don't move on until you have got that working.

    Then, your expression would be something like this:
    IIf(Not IsNull(Qry.Building),Sum(whatever))
    which means that if there is a valid record in the qry then it will sum it)

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

Similar Threads

  1. Replies: 5
    Last Post: 12-06-2011, 11:18 AM
  2. Subtract from Previous Row
    By lambo102 in forum Queries
    Replies: 1
    Last Post: 08-06-2011, 09:39 AM
  3. How to do subtract in Query
    By NoOoN in forum Queries
    Replies: 6
    Last Post: 04-07-2011, 01:15 PM
  4. Subtract from inventory
    By NISMOJim in forum Access
    Replies: 5
    Last Post: 01-30-2011, 01:09 PM
  5. Subtract Rows in Query Results
    By Sengenbe in forum Queries
    Replies: 5
    Last Post: 02-08-2010, 06:05 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