I have this text box that calculates from another text box (on the parent form) with another on a sub-form (data is entered here last). This will only show the result when the parent form is closed and re-opened.
What is the best method to get this to calculate whilst the form is open?
Updating a calculating text box.
-
- 5StarLounger
- Posts: 736
- Joined: 18 Mar 2010, 11:05
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Updating a calculating text box.
Is the text box on the subform bound to a field in the record source of the subform, or is it a calculated control too?
And what is the Control Source of the calculated text box on the main form?
And what is the Control Source of the calculated text box on the main form?
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 736
- Joined: 18 Mar 2010, 11:05
Re: Updating a calculating text box.
OK... answering in order;
the text box on the sub-form is not bound to a field. It too is a calculated control (gives max of related records).
The control source for the calculated text box on the main form is yet another calculation... well a conversion really;
=IIf([VolVal]="High",3,IIf([VolVal]="med",2,1))
Does that make sense?
the text box on the sub-form is not bound to a field. It too is a calculated control (gives max of related records).
The control source for the calculated text box on the main form is yet another calculation... well a conversion really;
=IIf([VolVal]="High",3,IIf([VolVal]="med",2,1))
Does that make sense?
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Updating a calculating text box.
You could create an After Update event procedure for the subform:
If necessary, you can also recalculate the main form in the On Current event of the main form itself:
Code: Select all
Private Sub Form_AfterUpdate()
Me.Parent.Recalc
End Sub
Code: Select all
Private Sub Form_Current()
Me.Recalc
End Sub
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 736
- Joined: 18 Mar 2010, 11:05
Re: Updating a calculating text box.
Cheers Hans, the first one does the trick.
Thank you
Thank you