Sales Order without TaxRegionCode

Odd one, in case anyone has any insight …

I have a function that creates a Sales Order from an incoming DataSet, and it’s doing what it should do with one strange exception. For one customer, orders are created without the TaxRegionCode set, and that affects the tax calculation.

It doesn’t happen when an order is created manually, even for that same customer, and the sequence of method calls in the function is the same. Logging what’s happening, the TaxRegionCode is present until the first call to MasterUpdate, and that wipes it out. Setting it subsequently doesn’t work because it gets wiped out on update each time.

I can’t see anything significantly different about the customer record, except that it’s a cash customer so credit hold is always triggered when the order goes in.

Any clues what might fix it?