I need some help on the SSDBGrid from Sheridan (no longer around) doing something simple and am missing something obvious. I am basically trying to get a running balance of numbers. The number for each row is in Col(10) and I want to have a running balance calculated and placed in Col(8) of that row, then move to the next. My problem in the code below is the line where I am trying to set the new value to the cell. The CellValue is a read only and their help files says to set a value you use the Value property. However, using the .Value property is not moving along with the rows as I move down, thus resulting in the Col(8) being set is always the first row, not each row as I work down.
I know I am just missing something simple. Please help
Mickey
VB Code:
'Make sure the accumulator is empty GLRunningBal = 0 LedgerGrid.Redraw = False 'Turn off so don't see movement 'Get current bookmark & first row to be able to return to same relative position CurrentBkMark = LedgerGrid.Bookmark CurrentVisableRow = LedgerGrid.FirstRow LedgerGrid.MoveFirst 'Cycle thru all the rows For X = 0 To LedgerGrid.Rows - 1 BkMrk = LedgerGrid.GetBookmark(X) 'Calculate the running balance column (col(8)) which is the number in col(10) of this row 'plus what the balance is up to this point GLRunningBal = GLRunningBal + Val(LedgerGrid.Columns(10).CellValue(BkMrk)) 'Here is the problem line LedgerGrid.Columns(8).CellValue(BkMrk) = GLRunningBal Next 'Return to original row & relative position LedgerGrid.FirstRow = CurrentVisableRow LedgerGrid.Bookmark = CurrentBkMark LedgerGrid.Redraw = True 'Turn back on
![]()
![]()




Reply With Quote