+ Reply to Thread
Results 1 to 20 of 20

Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Hi, I am a little new. I have used this forum since joining about one month ago, and have seen wonderful successes: because of the contributions of the other members. So thank you! I am able to do many advanced things in Excel, but am learning in Access.

    My task is to build queries from existing tables that hold fields with data numbers (order volume counts) related to Dates (month/day/year). I could Sum these into spreadsheet tables in Excel, but I need to learn Access.
    So I have many basic tables, that contain (columns of) volume numbers, representing orders (rows) by date (another column) per day, per months of Jan-Feb-Mar-Apr) for about 15 different products. These basic tables are specific per product, so Product A has orders in rows, with columns showing volume counts and monthly dates...however, the dates run from Jan to Apr.
    How do I build and run a query to collect each month per product, and sum the order numbers by the month, for each product?

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Here is a "Sample" File. Thanks.
    Attached Files Attached Files

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    I imported your sheet into Access and then created the following query

    Please Login or Register  to view this content.
    BTW, I question why you have different products in different tables. The product should be a field in your table and you could run your query all at once grouped on the product.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Alan,
    Thanks. I'll try it now.
    The products are in separate tables because they are generated from a warehouse shipping program that distributes to literally thousands of receivers, and the files are required to be tracked, and are huge as they are, with each product line and each specific, well, particular size. Otherwise, your suggestion (or question) would surely make sense to be all together. Wish.

  5. #5
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Alan,
    Works great! I understand what you did, now seeing it written out.

    A. How would you write the Query to Total for each month, the PO Numbers that fall into three groups:
    1. if it starts with "2013" it is called an "Ad Hoc" Allocation
    2. if it is a format of ####R###, it is a "coordinated" Allocation;
    3. if it is a format of ####S###, it is a "special" Allocation.

    B. How would you write a Query to total Jan, through April, by the Allocation type, by product? Again, doing one sheet is what I have supplied in the Sample file, however, I have the task of doing this for asbout 15 other sheets. All by a product name and size.

    Thanks!

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Try this:
    Please Login or Register  to view this content.
    or If you don't want to include the PO Number ( I wasn't sure from your description) then try this:
    Please Login or Register  to view this content.
    Last edited by alansidman; 07-10-2013 at 07:49 AM.

  7. #7
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Alan,
    You are amazing! It all works "right on!"
    I have to digest the commands you've written so I can be sure I understand, and then I should be able to translate it to a much larger (and wider) database.

    I am envious of your insight and expertise.
    Let me ask, since I think I saw you recommended to locate and use Crystal Long's Access tutorial on the Strive4Peace site...will much of what you are helping me with (and others), be achieved from Crystal Long's tutorial? I am only in Chapter 2 so far, but it's very helpful...though it seems to take some quantum leaps at times. I am quite willing to buy more books (add'l to the ones I've already invested in), ...do you have some recommendations? I need to become at least very advanced level in Access within the next 30 days. And with the appropriate resources, your advice, and some hard work and investment in hours, I am certain I can do it. Thanks! I will be staying in touch.

    PS BTW, I love the "beating a dead horse" icon you have. Cracks me up.

  8. #8
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Alan,
    On my next db, using and adjusting, I have two pop ups requesting Parameter Value for "Order_Create_Date" and (a Table Title) "Brand X. Count Of" . I do not know what the Parameter Value is.
    Your advice?

  9. #9
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Alan,

    Never mind this as below: I have found out that writing code in another app, then doing Cut & Paste doesn't work, unless written in NotePad. This cost me a ton of time, but I am learning!

    I have found that the Date fields I need to use, to run correctly by month (and year) are not in Date/Time per the Field properties. I didn't create the db, so no surprise there I suppose.
    So, from what I've been reading, I need to Sort the records in custom order, so the months will run correctly timewise, vs. alphabetically.
    So, looks like to get "January 2013" "February 2013" "March 2013" and "April 2013" to run, I have to set up an Advanced Filter/Sort.
    So I have written this code, but I keep getting the all too common "You may have added an operand without an operator" error. I've reviewed character by character, and still can't find my error.

    Here's the code line:
    IIf([Doc Date By Month] = “January 2013”, 1, IIf([Doc Date By Month] = “February 2013”, 2, IIf([Doc Date By Month] = “March 2013”, 3, IIf([Doc Date By Month] = “April 2013”, 4, 5))))

    The Field column I want to correct is called Doc Date By Month. What do I have wrong?
    Thanks in advance.
    (I am hoping you are out enjoying a perfect golfing day, here in Chicagoland today.)

    Last edited by Doc Snowfox; 07-10-2013 at 05:04 PM.

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Regarding the date issue: Use the CDate function in a query to change the text value January 2013 to 1/1/2013. Do this in an expression. Look at this link -->http://www.techonthenet.com/access/f...type/cdate.php

    Regarding the parameter issue. You have created a query and have field names that Access cannot find in the tables you have included in your query. this usually happens because of mis spelling of field names or spaces added or not included in field names. This is Access way of telling you that you have an error that needs to be corrected.

    For tutorials, I love google. Also, look at the links in my signature (the ones that reference Access), especially the one at DataPigTechnologies. I learned by searching the internet, forums like this and Virginia Anderson's Book on Access. There are many others, but I found hers to be very good.

    Crystal will give you the basics. Other stuff will come to you as you try to develop new databases. I am always learning from others in this and other forums.

  11. #11
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Again, terrific guidance. Thanks!

  12. #12
    Registered User
    Join Date
    07-10-2013
    Location
    brasil
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Thanks, Thanks

  13. #13
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Ok, help has been awesome. Thank you very much!

    Here's an update (and hopefully a dummy db attachment) for the next steps I need to make.
    As asked earlier, but with a too soimplified db, here's what I need to do next:

    A. How would you write the Query to Total for each month, the PO Numbers that fall into three groups:
    1. if it starts with "2013" it is called an "Ad Hoc" Allocation
    2. if it is a format of ####R###, it is a "Coord" Allocation;
    3. if it is a format of ####S###, it is a "Spec" Allocation.

    B. How would you write a Query to total Jan, through April, by the Allocation type, by product? Again, doing one sheet (Table) is what I have supplied in the Sample file, however, I have the task of doing this for about 15 other sheets (Tables). All by a product name and size.
    Attached Files Attached Files
    Last edited by Doc Snowfox; 07-11-2013 at 01:04 PM.

  14. #14
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    NOTE:
    I have the following code which is 98% working for me. Except that "2012" is running also as a "Special" from the query. That isn't correct. Actually, it'd be okay to add it to query as an "Ad Hoc" as well as the "2013".
    Anyone have any ideas? I know this is getting close to the "A." and "B." query results I need, as posted above earlier. Thanks in advance.

    SELECT Month([Doc Date]) AS [Month], IIf(Left([PO Number],4)="2013","Ad Hoc", IIf(Mid([PO Number],5,1)="R","Coordinated","Special")) AS Type, [Cray 12000].[PO Number], Sum([Cray 12000].[ConfirmQty]) AS SumOfConfirmQty
    FROM [Cray 12000]
    GROUP BY Month([Doc Date]), IIf(Left([PO Number],4)="2013","Ad Hoc",IIf(Mid([PO Number],5,1)="R","Coordinated","Special")), [Cray 12000].[PO Number];

  15. #15
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    The issue with the parameter request in your query for "Order_Create_Date" is that field does not exist in your table. If is supposed to represent a particular field then you will need to change that. That name was what you used in the original request in your Excel sheet. I'm guessing now that it is probably your Doc Date field.

    Here is a SQL statement that will include 2012 in Ad Hoc
    Please Login or Register  to view this content.
    Last edited by alansidman; 07-11-2013 at 10:51 PM.

  16. #16
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Thank you Alan. I was close, but not close enough. It works excellently. You've got me learning and trying. I very much appreciate your input, guidance and expertise. Thank you!
    Last edited by Doc Snowfox; 07-12-2013 at 11:13 AM.

  17. #17
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    You are welcome. Keep at it. It is a rewarding experience.

  18. #18
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    Again, spectacular results.
    Yes, I caught the field change earlier on and made those adjustments. The more I learn from you, and books, and try, the more I catch on and understand. Thank you Alan!

    A terrific forum, this is!

    Last step now, I need to write the SQL statement to show a sum of all products, on one query, by the month, i.e., totalling all the PO Numbers, per the "Type."

    Explained better: query all Types (totalling all the PO Numbers) by the month, Jan-Feb-Mar-Apr. This will entail pulling from current queries and then all 14 Tables. This will be an interesting task.
    Last edited by Doc Snowfox; 07-12-2013 at 11:16 AM. Reason: add clarity, remove redundant comments

  19. #19
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago
    MS-Off Ver
    MS Office 2010, 2007
    Posts
    40

    Thumbs up Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    (removed for duplication) .
    Last edited by Doc Snowfox; 07-12-2013 at 11:15 AM. Reason: duplication

  20. #20
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Access Used to Find, Tabulate and Sum Numbers by Monthly Dates

    I think the first step is to create a union query put all the information in your 14 queries into one query/table. You can then use that to do your aggregate query

    http://www.w3schools.com/sql/sql_union.asp

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1