Refresh form's text box

  • Thread starter Thread starter Wayne-I-M
  • Start date Start date
W

Wayne-I-M

Hi

I have a continuous form to add up values (currency)

Item A ItemCost £123
Item B ItemCost £456

I Have a button to convert certain records to negative (for discounts, etc)

Private Sub ItemConvertBut_Click()
If Me.ItemCost > 0 Then
Me.ItemCost = -ItemCost
Else
Me.ItemCost = Abs(Me.ItemCost)
End If
End Sub

This works fine but an other box (txtTotalCost) only updates when I leave
the record. If I set the focus to another control in the same record it will
not update - only if I set focus to another record.

Any ideas how to get the box (txtTotalCost) to update OnClick of
ItemConvertBut.
Have tried me.txtTotalCost.Refresh etc but does not seem to work.

Many thanks
 
Wayne,

First of all, I think you are going to have to explictly save the changes to
the record....
DoCmd.RunCommand acCmdSaveRecord

And then, if that doesn't sort it, also add another line at the end of the
code:
Me.Recalc
 
Back
Top