
How do you get a Column total for a grid?
Hi Frank, thanks for checking in.
Quote:
> Two things.
> 1) Put Option Explicit at the top of your code or else !
Always!
Quote:
> 2) x is obviously from some example you've seen and is generally used
> as an indicator that it is an index.
OK, I got the following to work:
For i = 0 To grdReportsGrid.ApproxCount - 1
grdReportsGrid.Row = 0 + i
Sum = Sum + grdReportsGrid.Columns(0).Value
Next
I need .Columns(0) so I can total the column. You can see that I
increment the row number according to the "i" value. It works fine
with a couple of
caveats:
1. I get a runtime error ("invalid row number") if the recordset
scrolls more than a couple of rows past the end of the grid's visible
default.
2. The only grid property I could find that would allow me to display
the Sum was the caption. Is there a way to insert a row into a grid
and output the Sum there? I looked at the grid methods and didn't see
anything hopeful.
I'm 90% of the way there. Hope you can help. Paul