Hi. I have this public function:

Public Function ItemUnitPriceSubtotal(lngOrderID As Long) As Currency

  Dim varX, varY

  varX = DSum("[ItemUnitPrice]*[ItemQuantity]*(1-[ItemDiscount])",
"tblOrderDetails", "[OrderID]=" & lngOrderID)

  varY = CCur(Nz(varX))

  ItemUnitPriceSubtotal = varY

End Function

Now the problem is that I want to get the "ItemUnitPrice" value not
from "tblOrderDetails" table but from another table called "tblItems".
(table tblItems includes this field too.)
That is, I'd like "ItemUnitPrice" value provided by table "tblItems",
and then "ItemQuantity" and "ItemDiscount" values provided by table
"tblOrderDetails".

The primary key field for table "tblItems", called "ItemID", must
match the value of the same field (i.e. "ItemID") stored in table
"tblOrderDetails".

Thanks, Theodore

Reply via email to