khan wrote:
its not working. here what i did. I put this code first behind the
change event of both textboxes, txtsaledetail and txtservisedetail at
the same time, it did nothing. when i put is behind form_current it
gave me an error "you cannot assing value to this object", Plz help me
man. it was looking so simple but it is too complex now. plz plz help
Ok, what I gave you before was "air code", and I can't make it work
either. However, I've tested this and it works. I don't have any
doubt at all that someone out there (David Fenton, Steve Jorgensen)
could find a more elegant solution, but since you're not paying me
{;-o>
Option Compare Database
Option Explicit
Private Sub txtSaleDetail_AfterUpdate()
txtBothTotal = 0
If Not (IsNull(txtSaleDetail)) Then
txtBothTotal = txtBothTotal + txtSaleDetail
End If
If Not (IsNull(txtServiceDetail)) Then
txtBothTotal = txtBothTotal + txtServiceDetail
End If
End Sub
Private Sub txtServiceDetail_AfterUpdate()
txtBothTotal = 0
If Not (IsNull(txtSaleDetail)) Then
txtBothTotal = txtBothTotal + txtSaleDetail
End If
If Not (IsNull(txtServiceDetail)) Then
txtBothTotal = txtBothTotal + txtServiceDetail
End If
End Sub
Bear in mind that when you set up a code-behind event, in order to be
sure that it binds correctly you need to locate the control on the
form, right-click the Properties, click the "Event" tab, locate the
event you want (in this case "AfterUpdate", click on the ellipsis
button to the right [...] and select "Code Builder".
Hope this helps
Edward