Refresh form's text box

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
 
S

Steve Schapel

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
 

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