Page 3 of 3 FirstFirst 123
Results 31 to 38 of 38
  1. #31
    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
    What exactly am I looking for? Query names 3A 3B are not very communicative.


    I used query 3E and Table customers_Info to build new query.

    Good luck
    Attached Thumbnails Attached Thumbnails QueryFNameLNameCustMostSpend.jpg  

  2. #32
    kiko is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2013
    Posts
    21
    Yes. I already did the exact same thing that you did. But it gives me wrong information. If you run the one without firstname and lastname, it shows another customer spent rm300plus. If i run the new one with firstname and lastname, it shows another customer. It should show the same results if the query is correct right? Do u get my point here? I'm really sorry for troubling w my poor english.

  3. #33
    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
    If you design the query to determine which CustId spent most, then adding a table to get the FName and LName won't change the query.

    If your original query is not designed, or doesn't give consistent results, then that is the issue.

    Take a calculator if you have to and sort out which CustId spend most. And SpendMost will involve
    #of Books * agreed to SalePrice

    10 Books @ 700 PriceUnits = 7000 spendunits

    So get that first query on which CustId spend most set up , tested and verified before moving on.

  4. #34
    kiko is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2013
    Posts
    21
    Yes orange. I already did exactly as what you desribed. I even tried using your sample database that you made based on my work. It gives different values as well.

  5. #35
    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
    Just used your data to build new query MyCustIdMostSpend

    SELECT TOP 1 Customers_Info.CustomerID, Sum([Price]*[quantity]) AS MySpend
    FROM (Customers_Info INNER JOIN Sales_Invoice ON Customers_Info.CustomerID = Sales_Invoice.CustomerID) INNER JOIN Sales_Details ON Sales_Invoice.Sales_Ref = Sales_Details.Sales_Ref
    GROUP BY Customers_Info.CustomerID
    ORDER BY Sum([Price]*[quantity]) DESC;

    This returns CustId 106 MySpend 362.5

    I used this query and the Customers_Info table

    and still get CustId 106 MySpend 362.5 as per attached jpgs

    Not sure where the issue is....

    Are you doing some additional calculations??
    Attached Thumbnails Attached Thumbnails newQueryUsiingMostSpendToGetFnameLName.jpg   ShowingFNameLNameCustIdAndMySpend.jpg  

  6. #36
    kiko is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2013
    Posts
    21
    Wow really?? Because I tried it, it gives me different results! I shall try again.

  7. #37
    kiko is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2013
    Posts
    21
    I gave it another tried and it worked this time. I think i must have been so confused and blurred. Really sorry for troubling you! But thanks a lot for your help orange!!

    One last question. How do i marked this thread as solved?

  8. #38
    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

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to order columns in ascending order?
    By darkingthereturn in forum Access
    Replies: 5
    Last Post: 06-18-2012, 05:24 AM
  2. Sort order in a sub form
    By roar58 in forum Forms
    Replies: 1
    Last Post: 03-17-2012, 08:57 PM
  3. Goods Order Form
    By amraam840 in forum Forms
    Replies: 7
    Last Post: 12-08-2011, 04:42 PM
  4. Sequential Order ID on Form
    By charya in forum Forms
    Replies: 1
    Last Post: 01-15-2011, 10:51 AM
  5. Help With Purchase Order Form
    By SpeedyApocalypse in forum Forms
    Replies: 29
    Last Post: 04-09-2010, 07:06 PM

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