Immediate calculation of a calculated control?

G

Guest

I have a subform with a footer, in which there is a textbox which sums a
value in the sub's records. On the mainform there is a textbox which control
source simply equals that subform textbox. This arrangement is working fine.

The problem I'm having is with a test I'm running on the summed value, and
the opening of a warning form if the sum is below X. This test is in the On
Exit event of the subform. I just noted that on an exit from the subform
with the sum below X, the textbox on the mainform did not show the total, and
the popup form did not appear. The mainform textbox updates if I hover my
mouse over it...

What method should I use to force an update to the mainform textbox so that
it is up to date when I exit my subform?
 
D

Dirk Goldgar

Ricter said:
I have a subform with a footer, in which there is a textbox which
sums a value in the sub's records. On the mainform there is a
textbox which control source simply equals that subform textbox.
This arrangement is working fine.

The problem I'm having is with a test I'm running on the summed
value, and the opening of a warning form if the sum is below X. This
test is in the On Exit event of the subform. I just noted that on an
exit from the subform with the sum below X, the textbox on the
mainform did not show the total, and the popup form did not appear.
The mainform textbox updates if I hover my mouse over it...

What method should I use to force an update to the mainform textbox
so that it is up to date when I exit my subform?

Assuming this code is running on the main form, not the subform, I think
you'll want to use

Me.Recalc

It's just possible that

Me!NameOfCalculatedTextbox.Requery

will do it, but that may not work for this sort of calculated control --
it may cause the entire form to be requeried, which is overkill.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top