B
Brian
I have a calculated control at the bottom of a continuous form to show totals
of a couple of fields. In order to ensure that they display the correct
information, I have this in Form_AfterUpdate:
Control1.Requery
However, after I update a record on the form and navigate to a new record,
Control1 does not update correctly. If I nagivate back onto the record that
was changed, they do show the correct totals, but then it changes back to the
pre-update total when I navigate back to any other record. In fact, if I
change multiple records, the calculated control contents will be different
based on which record I enter! Very odd behavior.
Requerying the entire form, Me.Requery, works correctly, but that is not a
solution as it will become slower as more data is entered because the form &
footer fields are based on a filtered list of records. Closing & reopening
the form also works.
Requerying the individual controls should work, and I have it working in
many other apps.
Here is the control source of the calculated control. The Filter1 refers to
an unbound combo box on the form that is used to filter the records based on
Field1.
=IIf(IsNull([Filter1]),0,DSum("[Field2]","[Table1]","[Field1] = " &
[Filter1]))
The IsNull is necessary because the criteria clause will generate an error
if the Filter1 control is null, as it is when the form is opened.
of a couple of fields. In order to ensure that they display the correct
information, I have this in Form_AfterUpdate:
Control1.Requery
However, after I update a record on the form and navigate to a new record,
Control1 does not update correctly. If I nagivate back onto the record that
was changed, they do show the correct totals, but then it changes back to the
pre-update total when I navigate back to any other record. In fact, if I
change multiple records, the calculated control contents will be different
based on which record I enter! Very odd behavior.
Requerying the entire form, Me.Requery, works correctly, but that is not a
solution as it will become slower as more data is entered because the form &
footer fields are based on a filtered list of records. Closing & reopening
the form also works.
Requerying the individual controls should work, and I have it working in
many other apps.
Here is the control source of the calculated control. The Filter1 refers to
an unbound combo box on the form that is used to filter the records based on
Field1.
=IIf(IsNull([Filter1]),0,DSum("[Field2]","[Table1]","[Field1] = " &
[Filter1]))
The IsNull is necessary because the criteria clause will generate an error
if the Filter1 control is null, as it is when the form is opened.