Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it Dsum or am I a dumbdumb?

Status
Not open for further replies.

TheAxe

IS-IT--Management
Apr 20, 2002
7
JP
Ok I have a table for receiving goods (ReceiveGoods) and it has:
1] RecQty - thats the amount ordered
2] RecRec - Thats the amount received

I have an inventory table for all my products which has:
1] Onorder

Problem:
I want to do: RecQty-RecRec by product in my Receiving table and place the result in Onorder in Inventory. This is the query I made

Update Query
Field: Onorder
Table: Inventory
Update to: DSum("[RecQty]-[RecRec]","ReceiveGoods","[Inventory]![inventoryID]"="[ReceiveGoods]![InventoryID]")

I get blanks when I run it. Why????
 
Sorry guys once I wrote it out a solution came to me:

I did one Dsum for one field - Dsum for the other field. Its a massive statement but it works. Anyone think of a more elegant solution?
 
Use Sum in query rather than DSUM

DSUM imp-lements sum by Access VBA
In query try to minimioze its use

 
Try this:

UPDATE tblInventory INNER JOIN tblReceivedGoods ON [tblInventory].[InventoryID]=[tblReceivedGoods].[InventoryID] SET tblInventory.OnOrder = [tblReceivedGoods]![QtyOrdered]-[tblReceivedGoods]![QtyReceived];

Looks like you're using query design view, so...

Add both tables and make sure they are joined one to many
Field: OnOrder
Table: Inventory
Update: Right-click and use build. Select your received goods table> RecQty > value > minus
Select received goods > RecRec > oK

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top