Subform and MainForm Total

G

Guest

Hi, there,

I believe a lot of you may come across this problem. A form was set up for
user to enter a couple of fields for calculation. User enters every field
correctly in first time. Press button to calculate the total which was used
to update something else - say a total field in Main form.

Then, user goes back and does the editing. However, instead of entering
everything, or TAB over to finish entering the whole information, user just
quits in the middle. As a result, some information has been changed and the
total as calculated is not consistent anymore.

We allow user to edit the record, of course, please give your advise how to
prevent those data inconsistency. Is there any code that force the user to
TAB over every field in a form or record.

Thank you.

BL
 
R

Rick Brandt

BL said:
Hi, there,

I believe a lot of you may come across this problem. A form was set
up for user to enter a couple of fields for calculation. User enters
every field correctly in first time. Press button to calculate the
total which was used to update something else - say a total field in
Main form.

Then, user goes back and does the editing. However, instead of
entering everything, or TAB over to finish entering the whole
information, user just quits in the middle. As a result, some
information has been changed and the total as calculated is not
consistent anymore.

We allow user to edit the record, of course, please give your advise
how to prevent those data inconsistency. Is there any code that
force the user to TAB over every field in a form or record.

Thank you.

BL

It is a fundamental rule that you do not store the result of calculations.
Store the DATA and when you need the result of the calculation let your computer
compute it (that's what they're good at).
 
G

Guest

I have a way of doing this. In my case the user enters a total on the main
form they then have to allocate in a continuous sub-form. The main form has a
bound field called TotalAmnt. In the detail section of the sub form the user
enters the line amounts. In the formfooter I keep a running total of these
amounts with a field called lineTotal whose ControlSource is =sum(lineamnt).
Finally in the main form I have a field which keeps track of the amount left
to allocate whose control source is
=[TotalAmnt]-nz([Forms]![Add Expenses Record]![ExpenseLinSub]!LineTotal,0).
I don't let the user leave the form until the amount left to allocate field
is zero.

If this isn't what you want then you could try using the Ondirty event to
ensure all calculations had been done before the user can leave the form. As
in your case keeping running totals in this way isn't logically necessary -
but it was a requirement so I had to make it happen. Good Luck!
 

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

Top