Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding data on data grid

Status
Not open for further replies.

lalee5

Technical User
Oct 20, 2002
70
0
0
US
I search most of the threads but found no solution. Pelase help if you can

I have a data grid that only display certain records that match my criteria.

I need to add up one of the columns.

I did a loop and it sums up the entire tables. I just need to add the displayed records.


Thanks in advance

Dim dTotal As Double
Dim rsclone As ADODB.Recordset

Set rsclone = Adopurchase.Recordset.Clone

With rsclone
rsclone.MoveFirst
Do Until .EOF
If Not IsNull(.Fields("purproductqty")) Then dTotal = dTotal + .Fields("purproductqty").Value
rsclone.MoveNext
Loop
Total.Text = dTotal
 
Hi,
Loop through just visible rows of the DataGrid like

For i = 0 To DataGrid1.VisibleRows - 1
dTotal = dTotal + DataGrid1.Columns(HereCloumNumber).CellText(DataGrid1.RowBookmark(i))
Next

Hope this will help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top