C
CW
I have a form (subform actually) based on a table, with the following controls:
Net Value - entered directly here by the user
Tax Type - this is a combo based on a TaxTypes table holding Types and Rates
and when the type is selected there's an After Update event (using If
statements) that populates the next control with the appropriate Tax Rate
Tax Rate - read only, driven by the above
Tax Value - a calculated control that multiplies the Net Value by the Tax Rate
Gross Value - a calculated control, Net Value + Tax Value
Problem: I have tried all manner of combinations of AfterUpdate events on
controls and on the form, but cannot get the Tax Value control to display the
calculated amount automatically, or even when I did, it wouldn't then change
automatically if the Tax Rate was subsequently changed. And it's vital that
it does, because (against all best practice) this value has to be stored in
the table, as it is then picked up by the import process of our accounting
system. I know you will grimace uo reading that, but in this case there's no
way round it.
What happens is that if a record has been created with the standard tax rate
all is well and is saved properly to the table. But if the user then realises
that tax is not applicable, and changes the TaxType to Zero, the TaxRate
changes to 0 but the TaxValue control doesn't re-calculate.
And the Save button, created via the wizard for Save Record, produces an
error: "The DoMenuItem action was canceled" (N.B. mispelt, should have two
lls in it!!)
So I tried a Refresh the Record button instead. That does force the correct
calculation, but it throws the message: "The |action was canceled".
Then I tried a Refresh the Form button - that produces "Runtime error 2501 -
the | action was canceled".
The only way I have found to force the calculation cleanly is to use
Records>Refresh on the top Access menu/dropdown.
What's going wrong? And since it works, is there any way to reproduce the
code used by the Records>Refresh menu item?
Looking forward to your advice - many thanks
CW
Net Value - entered directly here by the user
Tax Type - this is a combo based on a TaxTypes table holding Types and Rates
and when the type is selected there's an After Update event (using If
statements) that populates the next control with the appropriate Tax Rate
Tax Rate - read only, driven by the above
Tax Value - a calculated control that multiplies the Net Value by the Tax Rate
Gross Value - a calculated control, Net Value + Tax Value
Problem: I have tried all manner of combinations of AfterUpdate events on
controls and on the form, but cannot get the Tax Value control to display the
calculated amount automatically, or even when I did, it wouldn't then change
automatically if the Tax Rate was subsequently changed. And it's vital that
it does, because (against all best practice) this value has to be stored in
the table, as it is then picked up by the import process of our accounting
system. I know you will grimace uo reading that, but in this case there's no
way round it.
What happens is that if a record has been created with the standard tax rate
all is well and is saved properly to the table. But if the user then realises
that tax is not applicable, and changes the TaxType to Zero, the TaxRate
changes to 0 but the TaxValue control doesn't re-calculate.
And the Save button, created via the wizard for Save Record, produces an
error: "The DoMenuItem action was canceled" (N.B. mispelt, should have two
lls in it!!)
So I tried a Refresh the Record button instead. That does force the correct
calculation, but it throws the message: "The |action was canceled".
Then I tried a Refresh the Form button - that produces "Runtime error 2501 -
the | action was canceled".
The only way I have found to force the calculation cleanly is to use
Records>Refresh on the top Access menu/dropdown.
What's going wrong? And since it works, is there any way to reproduce the
code used by the Records>Refresh menu item?
Looking forward to your advice - many thanks
CW