I have a button at the end of each record on a continuous form and it needs to do this:
Private Sub Update_Click()
Dim SellP As Double
Dim BuyP As Double
Dim Profit As Double
SellP = DLookup(SellPrice, Flips, [Current])
BuyP = DLookup(BuyPrice, Flips, [Current])
Profit = SellP - BuyP
Flips.Profit = Profit
End Sub
Now I know this isn’t the correct code but I hope it will give you an idea of what it needs to do, essentially:
Find the SalePrice, find the BuyPrice, minus the BuyPrice from the SalePrice and make the result Profit, then populate the Profit field with profit..
Thanks!
The columns of the current record of the bound table/query are directly available in the code.
You can just write e.g.
Profit = SalePrice - BuyPriceif these fields are all part of the bound data.You might then move this code in the “AfterUpdate”-Event of both the SalePrice- and the BuyPrice-Textfields, maybe like this: