I thought I understood this issue pretty clearly, but ran into a situation using VSFlexGrid which made me question how much I really understand.
Please note that this is not a question about VSFlexGrid, but a more general one. You don't have to know dink about VSFlexGrid to help me with this.
VSFlexGrid has a property called "RowData", which is simply a way to associate Variant data with each row of a grid. For example:
fgrGrid.RowData(3) = "abc"
That line will store the string "abc" into a field for Row 3 of "fgrGrid", and can be retrieved later on via:
retrievedData = fgrGrid.RowData(3)
So far, so good. But I got into trouble when I wrote this line:
fgrGrid.RowData(3) = rst!DiskDataField
I thought this was a perfectly clear command, and expected the stored RowData to be whatever was in rst!DiskDataField at the time the command was executed.
Not so. In fact, what I got was the value of rst!DiskDataField at the time the data was **retrieved**. It's as if VSFlexGrid stored the expression "rst!DiskDataField" to RowData, and then evaluated it every time I retrieved it.
Needless to say, that's not what I had in mind. The following fixed the problem, though I consider it a gross kludge:
Dim str As String
str = rst!DiskDataField
fgrGrid.RowData(3) = str
Doing it that way, I always get the value of the recordset field at the time the last statement is executed, not when it's retrieved later on.
Now, this seems very weird to me. I know VSFlexGrid to be a superior grid, so I strongly suspect I'm missing something very important when I feel that the VSFlexGrid handling of RowData is just plain screwed up.
What am I missing?