Update Calculated text Box on Form

jco23

Registered User.
Local time
Today, 09:40
Joined
Jun 2, 2015
Messages
64
I have a form, within that form is a tabbed subform. within this tabbed subform is another subform (a table). The table is used for people to log information on a monthly basis. adjacent to this table are some text boxes with calculations in them tied to this table.

I would like for these text boxes to update/refresh their calculations after users enter information into the table. i would prefer it to be automatic, but a button reading "refresh calculations" would suffice.

I've tried me.controlname.requery, me.requery, me.refresh, and me.recalc but to no avail.

the only way so far that the data gets recalculated is when I exit the form and go back into it.

not sure what other information you may need to help me, so please let me know.

any help would be greatly appreciated.

thanks!
 
on AfterUpdate of your subform:

Private Sub Form_AfterUpdate()
Me.Parent!controlName.Recalc
end Sub
 
thanks for the quick response - what does the Parent! refer to? is it the form where the calculated text box resides? if so, it's not working for me.
 
got it to work. my problem was that I had the default value entered for the control box rather than entering the calculation in the VBA code.

I have a command button setup to read:
Private Sub recalc_Click()
Controlname.Value = DSum("[field1]", "[table1]", "[table1].[criteriafield] = '" & [criteriacontrolname] & "'")
Me.Recalc
End Sub
 

Users who are viewing this thread

Back
Top Bottom