Results 1 to 9 of 9
  1. #1
    AccessFailure is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    5

    Post Basic help with Access

    Hello,

    I need to be able to use Access to give me a list of all our customers, and then a total sales figure for each month of the year.

    The live data will come in as a table of all our orders, which will mean that there is more than one entry for each customer, these would need to be totalled depending on the month.

    In excel terms this would need a SUMIFS, but I wonder if this is possible to do in Access, and if so how to do it roughly?

    Thanks

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,842
    without knowing your full table structure, I would suggest you need a group by query - something like

    Code:
    SELECT CustomerID, Year(OrderDate) As OrderYear, Month(OrderDate) as OrderMonth, Sum(Sales) As SumOfSales
    FROM myTable
    GROUP BY CustomerID, Year(OrderDate), Month(OrderDate)

  3. #3
    AccessFailure is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    5
    That's helpful thank you, will I have to do a seperate query for each month or can I run all the months off one query?

    My date format is dd/mm/yyyy

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,842
    the code I provided will run for all months

  5. #5
    AccessFailure is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    5
    Sorry where do I put that code?

  6. #6
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,842
    in a query - what I have provided is 'pseudo code' (names are made up) because you haven't provided details of your table and field names so you will need to change them to match your real names (don't forget to use square brackets if you have spaces or non alphanumeric characters in your names). Hopefully you haven't used any reserved words in your names.

    Open a new query, close the table selection window and then click on the sql option in the ribbon (top left) then copy and paste in the code and change the names to suit. You can then go back to the query design view so you can see what the query looks like in a GUI

    In the future, if you want a response so you can simply cut and paste, provide details of your table and field names/types (text/number/date etc)

  7. #7
    AccessFailure is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    5
    Ajax,

    Thanks for your help.

    At the moment my data is in Linked ODBC tables, is it OK to use the data straight from here or does it need to go into a normal table first?

  8. #8
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,842
    you should be able to run it from your linked odbc table (replace myTable with the name of your odbc table)

    If in doubt - try it

  9. #9
    AccessFailure is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    5
    Thank you I will give it a go

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

Similar Threads

  1. Using Access Instead of Visual Basic
    By dinz in forum Programming
    Replies: 2
    Last Post: 12-19-2019, 10:33 AM
  2. VB Access Basic Question
    By tmw2912 in forum Programming
    Replies: 7
    Last Post: 02-08-2014, 05:26 PM
  3. how to use visual basic in access
    By learning_graccess in forum Access
    Replies: 3
    Last Post: 12-05-2011, 03:23 PM
  4. Basic Access Help
    By alex2300 in forum Access
    Replies: 2
    Last Post: 06-07-2011, 09:42 AM
  5. Basic access issues
    By c2bme in forum Access
    Replies: 1
    Last Post: 03-22-2010, 09:03 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