Tracy,
It means, that grid reconstructs itself. Vlad G explores this problem in all details in his first grid article in UT mag and also in FAQ here. See, if his FAQ can help.
The simplest (but time consuming solution) would be to have cursor created in Form's Load. Each time you make another select, zap the original cursor and append from the result of query.
>I have a grid (grid1) on a form. It's recordsource is a table that is created useing a sql statement in the form's load event. I have set up special column headings and comboboxes as the grid's controls to ease updates.
>
>I have an option group that will allow the user to change the records in the grid (by issuing a new select statement).
>
>When the form loads, the grid is populated as it should be and udpates occur as they should.
>
>However, when the user clicks on any of the options in the option group to change the select statement, the grid is repopulated as it should be, but it also goes to a 'generic' grid that does not contain my column headings, special controls in each column, etc. Why is this happening? Any ideas are greatly appreciated!
>
>Here is the initial population of the grid in the form's load that works correctly (grid is displayed correctly with appropriate controls, etc and update works):
>
>
>*Form Load
>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
> WHERE lcontrol.cn_name IN ;
> (SELECT ctrlname FROM ctrlset WHERE UPPER(ALLTRIM(ctrlset.ctrlname))="CONTRACT");
> INTO TABLE (hdir+"TEMPLCONTROL.DBF")
>
>
>Here is the code in one of the options of the option group that populates the grid and the table has the correct records, but the grid is now a generic grid and not the one on the form I customized:
>
>
>*option 1 of option group
>USE IN templcontrol
>SELE 0
>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
> WHERE UPPER(ALLTRIM(lcontrol.cn_name))="RECEIPT" ;
> INTO TABLE (hdir+"TEMPLCONTROL.DBF")
>SELE TEMPLCONTROL
>PRIVATE lSuccess
>lSuccess=CURSORSETPROP("Buffering", 5, "TEMPLCONTROL")
>IF lSuccess != .T.
> =MESSAGEBOX("ERROR! Could not set buffering mode on temporary table!",0,"Please exit this form and try again.")
>ENDIF
>THISFORM.GRID1.RECORDSOURCE=""
>THISFORM.GRID1.RECORDSOURCE='TEMPLCONTROL'
>THISFORM.GRID1.REFRESH()
>
>
>Thanks all for your help!
>Tracy
If it's not broken, fix it until it is.
My Blog