Results 1 to 3 of 3
  1. #1
    tsakdim is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    1

    Huge report with visits per customer-Grab the information of the last visit

    Hi Experts,




    we have a huge report in our company that includes all our customers, all the visits done by our sales reps, all the products they have and if a product was out of stock in the visit or not.


    I want to create a querry that exports a table with 3 columns:


    1-->customer
    2-->date of last visit
    3-->average of out of stock products on the LAST visit


    I tried to make a pivot table, managed to grab the last visit (setting the date to maximum) but the average of out of stock products were aggregated totally and not for the last day.

    I cannot find a solution.


    Have you any idea how to handle this in MS access 2010?


    Many Thanks ,


    Dimitris

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    This requires criteria based on value in another record of same table. Need nested subquery or domain aggregate functions (DLookup, DMax, etc)..

    Review: http://allenbrowne.com/subquery-01.html#TopN

    Try the TOP N example to return the most recent record for each customer and use that query as basis for a report with the Avg calc in report footer.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    The trivial method is to create a temp table with the date of last visit for each customer, and then query the out of stock for each record on the temp table.

    You almost reached the more advanced method. If you have a query that gets the date of last visit for each customer, then that query should be able to be joined to the other table to determine out of stock condition on that date.

    If you post the formats of the tables, and the query that's almost working, then we can help you figure it out.

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

Similar Threads

  1. Customer Information/Service Request Database
    By mbailey in forum Database Design
    Replies: 6
    Last Post: 05-18-2013, 03:47 PM
  2. Replies: 3
    Last Post: 02-27-2013, 10:35 PM
  3. Replies: 1
    Last Post: 05-25-2012, 04:13 PM
  4. Run Report For Each Customer
    By rivergum_23 in forum Queries
    Replies: 1
    Last Post: 04-29-2012, 12:53 PM
  5. Replies: 1
    Last Post: 12-24-2011, 08:48 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