Check all rows in continuous form?

M

mscertified

I have a continuous form that contains several rows. One column is a
percentage value. I must ensure that the percentages for each row adds up to
exactly 100. I guess I only need do this upon exit from the form. Is there an
easy way to do it rather than open a new recordset? Recordset clone maybe?
 
B

Bob Hairgrove

I have a continuous form that contains several rows. One column is a
percentage value. I must ensure that the percentages for each row adds up to
exactly 100. I guess I only need do this upon exit from the form. Is there an
easy way to do it rather than open a new recordset? Recordset clone maybe?

Try showing the form's footer and put a textbox control with the
formula "=Sum([<field with the percentage>])" where you replace the
part between "<>" with the real name of the field. You can make the
textbox hidden after you are sure it works. In your code you can just
use the value of that control instead of looping over a recordset, for
example.

If you want to keep the form open and show an error message when the
percentages don't add up, use the form's OnUnload event procedure
which can be cancelled in code.
 
Top