>When using an SQL select to generate a temporary table to use as the recordsource for a grid display on a form, the initial display presents correctly. The columns and headers are individually formatted and color selected as well as the enabled properties are set per field from the temporary file.
>
>When reselecting the data and issuing the form.grid.recordsource to the temporary table generated, as in the initial code, the resulting grid looses all of the formating, color, and enabled properties.
>
>Any ideas as to how to correct this issue?
When the grid's recordsource cursor disappears out from under the grid, everything gets lost.
My approach is usually to use a view for grid source and REQUERY() the view - that way the cursor doesn't go away.
If not using a view, before recreating the cursor, blank the RecordSource.
However, you have to store/restore the controlsource of each column - e.g.,
WITH thisform.grid1
lcRecordSource = .RecordSource
lnGridCol = .ColumnCount
DIMENSION laGridInfo(lnGridCol,1)
FOR jiCol = 1 TO lnGridCol
laGridInfo[jiCol,1] = .Columns(jiCol).ControlSource
ENDFOR
.RecordSource = ""
.RecordSource = lcRecordSource
FOR jiCol = 1 TO lnGridCol
.Columns(jiCol).ControlSource = laGridInfo[jiCol,1]
ENDFOR
ENDWITH
Insanity: Doing the same thing over and over and expecting different results.