Form/subform totals don't balance when subform empty


M Skabialka

I have a form with a subform. The user creates maintenance codes on the
main form. Later, vehicles are assigned these maintenance codes, and they
show up with the cost on the subform when a code is selected on the main
form. There is a total cost for all vehicles at the bottom of the subform.

On the main form is a $ amount allocated to the code. It then takes the
total amount spent so far on vehicles from the subform and shows the amount
of money left as the balance.

BUT, if the code has not been applied to any vehicles, and I select the
maintenance code on the main form, there is no subform to get the total
from, so the balance remaining shows as #Error.

I tried calculating it OnCurrent on the subform, but when I go from a code
with subform data to one without, it doesn't refresh the total spent so the
balance is wrong.

If I set the balance to null in the AfterUpdate of the maintenance code
combo it doesn't update from the subform to give a correct balance.

When in the list of events happening on this form/subform should I calculate
the balance, whether there are records on the subform or not?


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question