Dim spql As String
Dim ab, cd As Double
spql = "select * from emp"
RS.Source = spql
RS.Open
If RS.RecordCount > 0 Then
For i = 1 To RS.RecordCount
ab = RS.Fields("salary"
cd = RS.Fields("Netsalary"
RS.MoveNext
Next i
End If
RS.close
'here we will get the totals.
Dim strsql As String
strsql = "SELECT * FROM emp"
RS.Source = strsql
RS.Open
With RS
Do While Not .EOF
MSFlexGrid .TextMatrix(MSFlexGrid.Rows - 1, 0) = RS.Fields(0)
MSFlexGrid .TextMatrix(MSFlexGrid.Rows - 1, 1) = RS.Fields("salary"
MSFlexGrid .TextMatrix(MSFlexGrid.Rows - 1, 2) = RS.Fields("netsalary"
MSFlexGrid .Rows = MSFlexGrid.Rows + 1
Loop
End With
'here we will display the total records. And at the end
'this will display the totals.
MSFlexGrid.TextMatrix(MSFlexGrid.Rows - 1, 1) = ab
MSFlexGrid.TextMatrix(MSFlexGrid.Rows - 1, 1) = cd
RS.close
'Try this this will solve your problem. Best of luck,"
Srinivas_pvl@hotmail.com
Dim spql As String
Dim ab, cd As Double
spql = "select * from emp"
RS.Source = spql
RS.Open
If RS.RecordCount > 0 Then
For i = 1 To RS.RecordCount
ab = RS.Fields("salary"
cd = RS.Fields("Netsalary"
RS.MoveNext
Next i
End If
RS.close
'here we will get the totals.
Dim strsql As String
strsql = "SELECT * FROM emp order by salary"
'here you can write sorting quarry. Your last record
' will not be effected
RS.Source = strsql
RS.Open
With RS
Do While Not .EOF
MSFlexGrid .TextMatrix(MSFlexGrid.Rows - 1, 0) = RS.Fields(0)
MSFlexGrid .TextMatrix(MSFlexGrid.Rows - 1, 1) = RS.Fields("salary"
MSFlexGrid .TextMatrix(MSFlexGrid.Rows - 1, 2) = RS.Fields("netsalary"
MSFlexGrid .Rows = MSFlexGrid.Rows + 1
Loop
End With
'here we will display the total records. And at the end
'this will display the totals.
MSFlexGrid.TextMatrix(MSFlexGrid.Rows - 1, 1) = ab
MSFlexGrid.TextMatrix(MSFlexGrid.Rows - 1, 1) = cd
RS.close
'Try this this will solve your problem. Best of luck,"
Srinivas_pvl@hotmail.com
Private Sub FG_Sort(ByVal Col2Sort As Long)
Dim rows As Long
Dim cols As Long
Dim fixcol As Long
Col2Sort = Col2Sort - 1
rows = FG1.rows
cols = FG1.cols
fixrows = FG1.FixedRows
FG1.Col = Col2Sort
FG1.Row = fixrows
FG1.RowSel = rows - fixrows - 1
FG1.ColSel = Col2Sort
FG1.Sort = 1
End Sub
Merlinx has it.
From the Docs.
"The Sort property always sorts entire rows. To specify the range to be sorted, set the Row and RowSel properties. If Row and RowSel are the same, the MSHFlexGrid will sort all non-fixed rows."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.