Overriding tax to AR Invoice object

SUGGESTED

I'm trying to override the tax on the AR Invoice object, and while I'm successful at changing the amount on the AR Invoice Header, I'm having trouble changing the amount on the AR Invoice Tax Summary. Here's my code which fires on Post-Write of AR Invoice Header table:

calcResult = 1.23

set TaxSummary = oSession.AsObject(oSession.GetObject("AR_InvoiceTaxSummary_bus"))

retval = TaxSummary.SetKeyValue("InvoiceNo$", orderNo)
retval = TaxSummary.SetKeyValue("InvoiceType$", invoiceType)
retval = TaxSummary.SetKeyValue("ScheduleSeqNo$", "000001")
retval = TaxSummary.SetKeyValue("TaxCode$", "SOVOS")
retval = TaxSummary.SetKey()
retVal = TaxSummary.SetValue("SalesTaxAmt", CDbl(calcResult))
retVal = TaxSummary.SetValue("TaxableSalesAmt", trxAmt)
retVal = TaxSummary.SetValue("Overridden$","Y")
retval = TaxSummary.Write()

'confirm that the values have been written
retval = TaxSummary.SetKeyValue("InvoiceNo$", orderNo)
retval = TaxSummary.SetKeyValue("InvoiceType$", invoiceType)
retval = TaxSummary.SetKeyValue("ScheduleSeqNo$", "000001")
retval = TaxSummary.SetKeyValue("TaxCode$", "SOVOS")
retval = TaxSummary.SetKey()
taxAmt = 0.00
overridden = ""
retVal = TaxSummary.GetValue("SalesTaxAmt", taxAmt)
retVal = TaxSummary.GetValue("Overridden$", overridden)
If oSession.UI > 0 Then oSession.AsObject(oSession.UI).MessageBox "", "the tax amount on the tax summary object is " & cstr(taxAmt) & "|" & overridden

When I put a message box at the end of the function to pause any other script execution from Sage, and look at the back end using an ODBC connection, I see the value updated:

But after I continue script execution, and the screen clears, Overridden is set back to N and SalesTaxAmt back to zero.

Any ideas on what I'm doing wrong?