Assuming you have 5 fields on a form, you should be able to force a constant
sum of 100% across the fields, making user verification unnecessary.
For example, start with 20% in each of the 5 fields. When one of the fields
changes value, distribute 100 - [sum of modified fields] evenly across the
remaining unmodified fields. So if the user changes the Toyota field to 30%,
mark the Toyota field modified and distribute (100-30)/4 to each of the 4
remaining unmodified fields. And if the user then changes the Honda field to
25%, distribute (100-55)/3 to each of the 3 remaining unmodified fields.
Etc.
I suppose you will need some global variables (maybe an array?) to keep
track of which fields have been modified/marked; and you will probably need
a Reset button to reset the fields to the default 20% and unmark all fields,
if the user wants to start over; and you probably want to round to 2
decimals to force the math to be exactly right.
Ok, maybe the code gets a little complicated. Should be possible, however.
"richard" <no****@myplace.net> wrote in message
news:xJ******************@news-server.bigpond.net.au...
I have a table with 5 fields into which the user will enter numbers,
which must add up to 100%. Say the fields are Toyotas, Missans, Mazdas,
Hondas and Other. I am having trouble writing a query using Sum which
will add these together and place the result in another field called
"total" which I will then place on a form so the user can check it
contains value 100 for each record. Any help appreciated, thanks.