Personal Bidget In Forms

Q: I am new to access. I am trying to create a personal budget in access. I hope to do it in access because a form is easy to work with. In creating my form I wish to simply subtract expected expense from actual expenses. I have created three fields, expected expense, actual expense, and difference. In the difference field I tried to use an expression to subtract the other fields form each other. This did not work. Any suggestions?

A: As a general rule you should not keep the result of a calculation in a table. Calculate it as needed, on the form or in reports, in a temporary (ie: unbound to a table) field. Then, each time one of the fields changes, have an "after update" routine which performs the calculation and updates your total on your form. eg: Private Sub ExpenseExpected_AfterUpdate() Me.ExpenseDifference = Me.ExpenseExpected - Me.ExpenseActual End Sub Private Sub ExpenseActual_AfterUpdate() Me.ExpenseDifference = Me.ExpenseExpected - Me.ExpenseActual End Sub In your reports, calculate it in the query: ExpenseDifference: ExpenseExpected - ExpenseActual .

Discuss It!