Results 1 to 3 of 3

Thread: Sheridan Data Widgits 3 help please

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    164

    Sheridan Data Widgits 3 help please

    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:
    1. 'Make sure the accumulator is empty
    2. GLRunningBal = 0
    3.  
    4. LedgerGrid.Redraw = False    'Turn off so don't see movement
    5.  
    6. 'Get current bookmark & first row to be able to return to same relative position
    7. CurrentBkMark = LedgerGrid.Bookmark
    8. CurrentVisableRow = LedgerGrid.FirstRow
    9.  
    10. LedgerGrid.MoveFirst
    11. 'Cycle thru all the rows
    12. For X = 0 To LedgerGrid.Rows - 1
    13.     BkMrk = LedgerGrid.GetBookmark(X)
    14.  
    15.     'Calculate the running balance column (col(8)) which is the number in col(10) of this row
    16.     'plus what the balance is up to this point
    17.     GLRunningBal = GLRunningBal + Val(LedgerGrid.Columns(10).CellValue(BkMrk))
    18. 'Here is the problem line
    19.     LedgerGrid.Columns(8).CellValue(BkMrk) = GLRunningBal
    20.    
    21.    Next
    22.  
    23. 'Return to original row & relative position
    24. LedgerGrid.FirstRow = CurrentVisableRow
    25. LedgerGrid.Bookmark = CurrentBkMark
    26.  
    27. LedgerGrid.Redraw = True    'Turn back on


  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Sheridan Data Widgits 3 help please

    you specify the column to be 8, but not specifying the row at all

    is this valid
    VB Code:
    1. LedgerGrid.cells(x,8).CellValue(BkMrk) = GLRunningBal
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    164

    Re: Sheridan Data Widgits 3 help please

    By getting the bookmark first and then references it, that references you to that row. Just like the line above where it gets a value out of that row with:

    Val(LedgerGrid.Columns(10).CellValue(BkMrk))

    There is no .Cells, etc. The line above is right and works, I just can't seem to get it to set a value, only read one.

    Mickey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width