I have a MS Access (2016) database using linked tables to a MySQL database. In the access database I have a form I use for data entry. I needed certain fields to be recalculated (manually) when I click a Recalc button.
The problem I am having is that when I run the VBA code to update fields on the form, if I then try to navigate to another record I get the error "This record has been changed by another user since you started editing it...."
I am the only user accessing this database. Everything works fine if I DON'T update a bound field on the form. Once I do, then I get that error when navigating to the next record.
Here is my vba code for the Recalc button:
Private Sub Recalculate()
vendorID = Me.product_supplier_id
supplierID = "supplier_id=" & vendorID
supplierHandling = Me.product_handling
vendorFee = Me.product_vendor_fee
supplierMarkupPercent = DLookup("supplier_markup_percent", "suppliers", supplierID)
supplierMarkupFixed = DLookup("supplier_markup_fixed", "suppliers", supplierID)
productCost = Me.product_cost
productShipping = Me.product_shipping
totalCost = productCost + productShipping + supplierHandling
totalCost = totalCost + vendorFee
markup = supplierMarkupFixed + (totalCost * supplierMarkupPercent)
productPrice = (totalCost + markup) / 0.85
amzFee = productPrice * 0.15
totalCost = totalCost + amzFee
profit = productPrice - totalCost
Me.product_total_cost = totalCost
Me.product_price = productPrice
Me.product_profit = profit
SetPriceColor
End Sub
The 3 statements near the end (before the SetPriceColor) are the culprits.
I am not sure how to resolve this issue. I have combed through many google searches, but nothing jumps out at me a solution for this specific case.