I have a datagrid that the user can edit, delete. add etc and it works fine.

The total from one currency column needs to be automaticly updated after the user makes changes and he clicks a Save cmdbutton. At the moment with this code I can only make it work by using a seperate command button to update the total. I would like to do it without using a cmdbutton to update the total. The error I get if I include the code anywhere else is you cannot add a empty row. Hopefully someone can show me how to modifiy this code.

VB Code:
  1. If Adodc2.Recordset.RecordCount <> 0 And Adodc2.Recordset.BOF = False And Adodc2.Recordset.EOF = False Then
  2. Dim fmtCurr As New StdDataFormat
  3.  fmtCurr.Format = "Currency"
  4.  Set DataGrid1.Columns(1).DataFormat = fmtCurr
  5.  Dim rs As ADODB.Recordset
  6. Dim dSum As Double
  7. Set rs = Adodc2.Recordset.Clone
  8.  
  9.  
  10. rs.MoveFirst
  11. Do Until rs.EOF
  12.     If IsNumeric(rs("ValueChgOrder")) Then _
  13.             dSum = dSum + rs("ValueChgOrder")
  14.         rs.MoveNext
  15. Loop
  16.  
  17. Set rs = Nothing
  18.  
  19. txtTotal.Text = FormatCurrency(dSum)
  20. Else
  21. txtTotal.Text = ""
  22.  
  23. End If

Thanks for any help