Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem Refreshing Grid on Form
Message
 
To
18/07/2002 14:17:39
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00680117
Message ID:
00680198
Views:
23
This message has been marked as the solution to the initial question of the thread.
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform