Click here to Skip to main content
15,922,145 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Dear all. This is sarfaraz here again.
I have almost completed my project with couple of issues.
1. I want to create a data report in vb6 with total sum column(page total).
2. How to set customised column heading in msflexgrid.
The code as under i tried MSFlexgrid Formatstring but no success.
Thank you



VB
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
Posted
Updated 20-Nov-12 2:16am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900