If you take a look at the sample Northwind database which comes with Access
you'll see that the Products table has a UnitPrice column in which the
current price of each product is stored. The Order Details table also has a
UnitPrice column in which the price of each product at the time of each order
is stored.
The current price is inserted into a row in the Order Details table when a
new row is added to that table via the Orders Subform by means of the
following code in the AfterUpdate event procedure of the OrderID combo box:
On Error GoTo Err_ProductID_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ProductID = " & Me!ProductID
' Look up product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
Err_ProductID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ProductID_AfterUpdate
Consequently when the unit price of a product is changed its simply a matter
of changing, via the Products form, the value of the UnitPrice column in the
relevant row of the Products table. Any new orders will then use this price,
but all previous orders will retain the price in force at the time of the
order.
I'd imagine you might want to do something analogous to this.
Ken Sheridan
Stafford, England