02-21-2004, 02:55 PM
Join Date: Jan 2004
Location: Conyers, Georgia
auto update a txtbox with a column in dataGrid
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 another 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.
visual basic 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
Do Until rs.EOF
If IsNumeric(rs("ValueChgOrder")) Then _
dSum = dSum + rs("ValueChgOrder")
Set rs = Nothing
txtTotal.Text = FormatCurrency(dSum)
txtTotal.Text = ""
Thanks for any and all help