Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Posts
    2

    Unhappy Show revenue by month problem


    Hey everyone,
    So my assignment is to create a query that generates the Revenue by Month for 2001 and 2002.
    I'm very new to Access, but what I tried to enter was:
    In one field, I put: Expr1: Format([order_date],"mmmm yyyy")
    With the criteria set to >#12/31/2000# AND <#01/01/2003
    The second field I put: Expr2:[line_item_price]*[line_item_quantity]
    And put "Sum" as the total.

    I'm pretty sure the Expression 2 is correct, but when I run the query nothing shows up. So I'm assuming something is wrong with Expression 1? Any suggestions? Or if you have a better way for me to generate revenue by month, let me know!
    Thanks very much!

  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,640
    I think you want the criteria on the order_date field, not the formatted field. Change the totals row to Where for that field so it doesn't mess with your grouping. In other words, you'll have 3 fields in the query instead of 2.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Apr 2011
    Posts
    2
    Pbaldy,
    That worked fantastically! Thank you! One other question, if possible I would like to sort my data in order of when the dates actually occurred, but at the moment I can only get it to sort Alphabetically by month (when I select Sort: ascending/descending). Is there a way to get it to sort by month order instead of alphabetically? Hope that makes sense,
    Thanks so much!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Try adding another field for sorting:

    Format([order_date],"yyyymm")

    You can group by that field; it shouldn't change the result.
    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. Replies: 2
    Last Post: 03-26-2011, 02:43 PM
  2. Track capacity changes month by month
    By Nils in forum Database Design
    Replies: 1
    Last Post: 02-18-2011, 03:03 PM
  3. First Day of Next Month
    By swalsh84 in forum Programming
    Replies: 6
    Last Post: 01-14-2011, 12:29 PM
  4. Replies: 5
    Last Post: 11-15-2010, 06:12 PM
  5. Replies: 2
    Last Post: 09-26-2009, 07:19 AM

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