Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006
    Posts
    16

    Query that sums multiple fields which need to change each month

    I have two tables (see attachment)


    One (tbl_Sales) has sales for different offices with a different value for each month in different columns (eg Jan, Feb, Mar, etc..)
    The second (tbl_Months) list a month number.

    Is it possible to write a query that will sum the columns in tbl_Sales based on the month number in tbl_Months? For example, if the month number is 2, then the query needs to sum Jan and Feb.

    The goal is to be able to change the month number each month instead of rewriting the queries each month.

    tbl_Months can be restructured in any format that will make the query more effective.

    Thanks for your help.
    Attached Files Attached Files

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    You are building a spreadsheet not a database.
    Construct a data model and Normalize you tables

    I see at least these tables.
    Office
    OfficeSales
    MonthInvolved

    You will probably need to keep Year in the table as well unless this is a 1 year design.
    An Office has 1 or more Sales each Month

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

Similar Threads

  1. Replies: 6
    Last Post: 02-13-2014, 11:10 PM
  2. Replies: 1
    Last Post: 09-27-2013, 09:44 AM
  3. Replies: 10
    Last Post: 10-19-2012, 05:10 AM
  4. Rolling 3 Month sums
    By michaeljohnh in forum Reports
    Replies: 1
    Last Post: 11-08-2010, 05:51 AM
  5. % Change by Month in a Cross-tab Query
    By William McKinley in forum Queries
    Replies: 0
    Last Post: 07-10-2010, 11:45 AM

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