-----Original Message-----
Hi,
The suggestion is certainly _not_ to dispense with the Bill table; you are
right to insist that the record remains, since it is in the Bill table that
the BillChecked, BillPaid and so on values reside.
It is simply that if you have a form into which you can enter new (and edit
existing) Bill records, then part of the function of that form will be to
sum the CompValue fields in the linked rows of the BillComponent table.
If it turns out that the sum of those fields is - always and ever - exactly
related to (or even equal to) the BillValue, then BillValue becomes a
redundant item. As in, you do not need it because you can compute the value
from elsewhere.
In your case, it has the added benefit that you can be sure that the
management analyses based on the BillComponent records will necessarily
correlate with the financial records - nominally based on the Bill table -
because they are quite literally based on the same figures. Yet another
benefit is the 'autocheck' effect at data entry ... where a correlation
between the bill value of the phone bill and the summation of the detail
lines confirms that all details have been entered.
Now your point about including a sum in a recordset resulting in the
recordset becoming 'read-only'. If we assume for the present purpose that
this is correct, it does not matter. Because that is not the query we are
using.
If the main form is based on the Bill table (where Bill table does not
include the BillValue field), then a subform displaying the related
BillComponent records can deliver a sum of the CompValue fields back to the
main form - if that's where you want to display it.
Even if you don't want to display the subform, you could use a domain
aggregate function to an unbound text item to display the summation.
Something like:
ControlName: calc_BillValue
ControlSource:
=DSum("CompValue","BillComponent","BillId="&Cstr ([BillId]))
In any other situation where you need the summation for BillValue - enquiry,
reporting etc - you can use the accumulation query that you appear already
to be familiar with.
So, the key element to get you moving forward again is to base the Bill form
on the Bill table (or a filtered view of) and not on a summation.
Good luck
CD
ye sjust now i success to read your replay
it is a wonderfull flowchart , it is exactly what i want
but there is a remark :
you said :
( There is a case to make that the sum of CompValue for
all BillComponents for have
to determine if
who that ? who i can get the billvalue amount ? by query
then i cannot add any flag to ( checked-paid ) fields
beacuse it will be derived bu group query which will be
only unupdatable
.