Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem Refreshing Grid on Form
Message
From
18/07/2002 16:45:48
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00680117
Message ID:
00680210
Views:
20
YES, YES, YES! But why does emptying the value of the recordsource property BEFORE requerying (instead of AFTER like I was doing) prevent the grid from having to be rebuilt? I'm so happy it works! Thanks Tom!

Tracy

>>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
>
>
>Tracy;
>
>Will this work?
>
>
>*option 1 of option group
>THISFORM.GRID1.RECORDSOURCE=""
>
>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='TEMPLCONTROL'
>THISFORM.GRID1.REFRESH()
>
>
>Tom
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform