Is there a way to continue editing an account after using the update DML statement? I keep getting the error: "attempt to dereference a null object". The reason that I am trying to update the account twice is because I need a formula field to populate in order to use the field value.
for (Account acc : [SELECT Id, Name FROM Account WHERE Id = :eventId LIMIT 1])
{
acc.Property__c = propertyId;
acc.HST__c = acc.Subtotal_2__c * 0.13;
acc.Payment_Total__c = acc.Subtotal_2__c + acc.HST__c;
update acc; //UPDATE ACCOUNT FIRST TIME (should populate formula field)
acc.Investor_Payout__c = (((acc.New_Payment_Recieved__c + acc.Investor_Payout_Adjustment__c) / 1.13) - acc.Investor_Cleaning_Deduction_Paid__c) * (acc.Investor_Split__c / 100);
update acc; //UPDATE SECOND TIME