S
slim
I have an Orders form with an OrderDetails subform with
the following fields:
CustomerID, OrderDate, ProductID, Quantity, CurrentPrice,
Discount, LineAmount
The CurrentPrice field needs to retrieve an amount from
the UnitPrice in the Products table as soon as the
ProductID is inserted.
How the heck do I get this to work???
I've put in the following VB code using an On Enter Event
Procedure:
Private Sub CurrentPrice_Enter()
Dim mydb As Database
Dim productSet As Recordset
Dim ProductNumber As Integer
Dim UnitPrice As Double
Set mydb = CurrentDb()
Set productSet = mydb.OpenRecordset("tblProducts")
ProductNumber = [Form_frmCustomersOrderDetails
subform].ProdID.Value
productSet.Index = "PrimaryKey"
productSet.Seek "=", ProductNumber
UnitPrice = productSet!UnitPrice
[Form_frmCustomersOrderDetails subform].CurrentPrice.Value
= UnitCost
productSet.Close
End Sub
the following fields:
CustomerID, OrderDate, ProductID, Quantity, CurrentPrice,
Discount, LineAmount
The CurrentPrice field needs to retrieve an amount from
the UnitPrice in the Products table as soon as the
ProductID is inserted.
How the heck do I get this to work???
I've put in the following VB code using an On Enter Event
Procedure:
Private Sub CurrentPrice_Enter()
Dim mydb As Database
Dim productSet As Recordset
Dim ProductNumber As Integer
Dim UnitPrice As Double
Set mydb = CurrentDb()
Set productSet = mydb.OpenRecordset("tblProducts")
ProductNumber = [Form_frmCustomersOrderDetails
subform].ProdID.Value
productSet.Index = "PrimaryKey"
productSet.Seek "=", ProductNumber
UnitPrice = productSet!UnitPrice
[Form_frmCustomersOrderDetails subform].CurrentPrice.Value
= UnitCost
productSet.Close
End Sub