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:
If Adodc2.Recordset.RecordCount <> 0 And Adodc2.Recordset.BOF = False And Adodc2.Recordset.EOF = False Then Dim fmtCurr As New StdDataFormat fmtCurr.Format = "Currency" Set DataGrid1.Columns(1).DataFormat = fmtCurr Dim rs As ADODB.Recordset Dim dSum As Double Set rs = Adodc2.Recordset.Clone rs.MoveFirst Do Until rs.EOF If IsNumeric(rs("ValueChgOrder")) Then _ dSum = dSum + rs("ValueChgOrder") rs.MoveNext Loop Set rs = Nothing txtTotal.Text = FormatCurrency(dSum) Else txtTotal.Text = "" End If
Thanks for any help




Reply With Quote