Results 1 to 4 of 4
  1. #1
    leonhuynh2006 is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    9

    Dsum criteria problem

    Dear all bro,



    Please take a look at my work. I have been trying many ways to solve the problem but I could not.

    The problem in the query, Dsum expression. I would like make the criteria that the "Status" in the table tb_order = yes, but Access says it can not find the name. Please help me. Many thanks.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Hi

    Maybe this what you are looking for:
    Code:
    SELECT Tb_Inventory.PartName, Tb_Inventory.QC1, Tb_Inventory.QC2, Tb_Inventory.QC3, Tb_Inventory.QC4, Tb_Inventory.Side, Tb_Inventory.DK, Sum(Tb_OrderDetails.Quantity) AS SumOfQuantity
    FROM Tb_Order RIGHT JOIN ((Tb_Inventory LEFT JOIN Tb_OrderDetails ON Tb_Inventory.MSHH = Tb_OrderDetails.MSHH) LEFT JOIN tb_Toa_Details ON Tb_Inventory.MSHH = tb_Toa_Details.MSHH) ON Tb_Order.OrderID = Tb_OrderDetails.OrderID
    GROUP BY Tb_Inventory.PartName, Tb_Inventory.QC1, Tb_Inventory.QC2, Tb_Inventory.QC3, Tb_Inventory.QC4, Tb_Inventory.Side, Tb_Inventory.DK, Tb_Order.Status
    HAVING (((Tb_Inventory.PartName)="bac nhat") AND ((Tb_Inventory.QC1)="3t") AND ((Tb_Order.Status)=True));
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    leonhuynh2006 is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    9
    Thanks for fast reply.

    However, your code is not what I am looking for. I am looking for Dsum as I need to do some multiple Dsum calculations. I wonder why Access does not find the name of tb_order.Status? Hope you understand what I am saying. Sorry for my english.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Hi
    DSum("Quantity","Tb_OrderDetails","Tb_order.Status =yes")
    This can't work because there is no field called "Tb_order.Status" in the table "Tb_OrderDetails".

    It may work if you create a query that has both tables in it, and then use that query in DSum instead of "Tb_OrderDetails".
    Maybe something like:
    Code:
    DSum("Quantity","NewQuery","Status=yes")
    The new query would need to contain both the Quantity and the Status fields.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. DSum problem, please help!!
    By Chissy in forum Queries
    Replies: 3
    Last Post: 08-10-2011, 07:39 AM
  2. DSum criteria using a variable that has been defined
    By beanhead0321 in forum Programming
    Replies: 5
    Last Post: 07-24-2011, 09:57 PM
  3. How to use a create a DSum with multiple criteria
    By FlyingDisc in forum Reports
    Replies: 1
    Last Post: 01-05-2011, 08:31 PM
  4. DSUM with date criteria from form
    By krutoigoga in forum Reports
    Replies: 4
    Last Post: 07-28-2010, 01:32 PM
  5. Replies: 1
    Last Post: 05-05-2010, 01:54 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