BASE: how to check data consistency before writing record to a table?

When the user fills in a form in BASE, I want to be able to check that the data he has entered is consistent before I write a record in the table. For example, if he types 52 for the number of clients seen this week, and then types in the number of those clients in each of say 15 exclusive categories, I want to ensure that the sum of those 15 entries is 52, and that he hasn’t made an error in the distribution of those 52 clients between the 15 categories. I want to do this before the data is written as a new recording the associated table.

I’m guessing people want to do this sort of thing all the time, and it’s simply my inexperience with BASE that is making it difficult for me.

Any tips, guys?
Much appreciated.

Normal way in databases is to get consistent data by creating a constraint together with CHECK. But seems I don’t understand well what you have written:
One form with number of clients = 52. 15 Categories in this form? And in each category is written the name of one or more clients? And all this should be saved in one table?

An example would help here.

Thanks for your interest. I’ve oversimplified the problem in the hope speeding up the reading of it.

It’s a monitoring application and most of it is adding up numbers. Thus there is a total number of clients seen in each month. Then there are a number of classes of attribute (eg breakdown by age, by ethnicity, by nature of enquiry, by service provided, and so on). In some classes the totals must add up to the total number of clients seen that month, and it is that I am trying to check before a new record is created, simply to reduce the possibility of accidental error. Every field is a number, and these numbers must be totalled for each quarter etc.

I hope that makes things clearer. Again, let me repeat that I am a beginner in Base, so I may be overlooking obvious solutions.

Thanks for any help.