Results 1 to 4 of 4
  1. #1
    simplefahad2005 is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Jul 2012
    Posts
    2

    Problem in Query and DSUM function

    I am using this query regarding stock card in my application but it is giving error undefined dsum expression. please help me in this regards. Thanks in Advance.


    Query is mentioned below.
    My query is below kindly help me.
    Thanks in advance.

    SELECT Stock_Card.StockCardID AS StockCardIDAlias, Stock_Card.StockID AS StockIDAlias, Stocks.Stock, Stock_Card.DateInsert, Stock_Card.ID, Stock_Card.Type, Stock_Card.RefNo1, Stock_Card.Pieces1, Stock_Card.Cost, [Stock_Card]![Cost]*[Pieces1] AS PurchaseAmount, Vendors.Company AS vendor, Stock_Card.RefNo2, Stock_Card.Pieces2, Stock_Card.SalesPrice, [Stock_Card]![SalesPrice]*[Pieces2] AS SalesAmount, Clients.Company AS client, Stock_Card.ICode,
    DSum("[Pieces1]-[Pieces2]","Stock_Card","[StockCardID] <" & [StockCardIDAlias] & " And [StockID] = " & [StockIDAlias] & "") AS Previous, DSum("[Pieces1]-[Pieces2]","Stock_Card","[StockCardID] <=" & [StockCardIDAlias] & " And [StockID] = " & [StockIDAlias] & "") AS [On Hand]
    FROM Clients RIGHT JOIN (Vendors RIGHT JOIN (Stock_Card LEFT JOIN Stocks ON Stock_Card.StockID = Stocks.StockID) ON Vendors.VendorId = Stock_Card.VendorID) ON Clients.ClientID = Stock_Card.ClientID;

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    It looks like you are trying to perform a calculation in the dsum, i think you need to perform the calculation by doing 2 dsums and then performing the calulcation.

  3. #3
    simplefahad2005 is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Jul 2012
    Posts
    2
    Yes am doing calculation ind dsum.
    Please tell me how to remove error "Undefined dsum expression".

    Thanks

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    I'll try to reiterate.

    The problem is you are trying to do a calculation in a DSUM, the function doesn't work like that read here. You have to DSUM each value and then perform the calculation.

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

Similar Threads

  1. Dsum problem help?
    By manos39 in forum Forms
    Replies: 0
    Last Post: 01-12-2012, 05:53 AM
  2. Dsum criteria problem
    By leonhuynh2006 in forum Queries
    Replies: 3
    Last Post: 10-04-2011, 03:18 AM
  3. DSum problem, please help!!
    By Chissy in forum Queries
    Replies: 3
    Last Post: 08-10-2011, 07:39 AM
  4. DSum in Query - Adding groups
    By Huddle in forum Queries
    Replies: 1
    Last Post: 02-04-2011, 07:53 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