Private Sub Command1_Click() On Error Resume Next Connection Set rs = New ADODB.Recordset sql = "select investigation,rate from patients where receipt_no=" & text1.Text & "" rs.Open sql, Con, adOpenDynamic, adLockOptimistic rs.MoveFirst Do While rs.EOF = False sql = rs.Fields(0) & vbTab & rs.Fields(1) sql = sql & vbTab & "" Form5.MSFlexGrid1.AddItem sql Form5.MSFlexGrid1 = rs.Fields(0) Form5.MSFlexGrid1 = rs.Fields(1) x = x + 1 rs.MoveNext Loop rs.Close Con.Close Set rs = Nothing Set Con = Nothing Call TotalColumn End sub Public Function TotalColumn() Dim R As Long Dim Total As Integer For R = 0 To Form5.MSFlexGrid1.Rows - 1 If IsNumeric(Form5.MSFlexGrid1.TextMatrix(R, 1)) Then Total = Total + Form5.MSFlexGrid1.TextMatrix(R, 1) End If Next R Form5.Label37.Caption = Total End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)