>Hi,
>
>I'm having a heck of a time with a grid that I'm using in one of my forms, here's the problem:
>
>My grid's recordsource is set to a cursor. Every time the user clicks on a different date, that cursor is re-created on the fly with the updated information. Once the cursor is re-created, however, my grid loses all it's properties (formatting) and looks pretty sad. That's why in my method which performs the SQL statement which re-creates the cursor, I re-format my grid.
>
>The point is, I don't want to have the grid's properties get reset on the fly because that presents problems with my textbox class which is in the grid columns (and calls right click menu, etc.).
>
>Does anyone know of a way I can keep the grid from losing it's formating properties whenever I recreate the cursor that's used as it's recordsource?
>
>Much appreciated for any help!
>
>-JT
>
>P.S. I want to avoid using a view here if possible due to the complex nature of my SQL statement (view designer does not like more than one join and UDF calls).
Hi all!
Jeff, Grid may become ugly outlook after changing the recordsource especially the controlsource column width are totally different!!
Besides, the column, header, controls object in grid may release after change recordsource....
So, you are better to reset all properties for grid on init()
Besides, there will be a
Known Bug on grid IME mode!
You need to remove the default text1 obejct and re-add again in
RUN-TIME to fix it!!
For example reference, you can download the
bwtable.zip in file section.
I ve add some action on grid.init() so that whatever change recordsource to alias or SQL cursor ... the grid still give expected outlook and properties!
With Thisform.grid1
.recordsourcetype = 0
.recordsource = ""
.columncount = -1
.recordsourcetype = 1
.recordsource = "MyAlias"
.init()
.refresh()
endwith
Surely bwtable will give a general idea on change recordsource of grid.
p.s. I ve no time to update the bwtable behaviour,
because I have not learn the command <B>set filter to</b> before make a SQL search instead... >-<'
Anyway, it still a good example for beginer.
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.