Update executed via VBA

jeudi 19 mars 2015

I have created a query in access to update a field called UPDATE_PROD_COST_EUR (not referenced specifically below) based on values in PRODUCT_COST and PRODUCT_COSTS_CURRENCY.



The idea being if a user changes either of 3 values below (via a form) the euro value will recalulate by executing the query UPDATE_PROD_COST_EUR_ICE.



The problem seems to be that although it works - it seems to happen VERY slowly. So slowly that I get a write conflict if I change the same value within say 20 seconds as I think it is still processing the update. The thing is, if I use the update query by double clicking, it is instantaneous apart from the warning about number of records being updated. This message does not appear when vba executes.



Any idea why it seems to execute so slow when called by CurrentDb.Execute ?





Private Sub PRODUCT_COST_AfterUpdate()

CurrentDb.Execute "UPDATE_PROD_COST_EUR_ICE"

End Sub



Private Sub PRODUCT_COSTS_CURRENCY_AfterUpdate()

CurrentDb.Execute "UPDATE_PROD_COST_EUR_ICE"

End Sub



Private Sub SHIP_DATE_AfterUpdate()

Me.YEAR_SHIP_DATE = Year(Me.SHIP_DATE)

Me.MONTH_SHIP_DATE = Month(Me.SHIP_DATE)

CurrentDb.Execute "UPDATE_PROD_COST_EUR_ICE"

End Sub

Update executed via VBA

0 commentaires:

Enregistrer un commentaire

Labels