Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Revisiting the Grid Update with different tables
Message
From
25/06/1998 12:10:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/06/1998 08:48:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00111506
Message ID:
00111591
Views:
17
>This has reference to a request I had put out earlier re wgere a grid is used to display data from a select into a table. The problem was that when I ran another select to the same table the grid used (same subset of data) the grid disappeared.
>
>I had received many ideas mostly about parametised views (not valid here) and one which I did implement re to create a grid object (class) and re instance that with each new select.
>
>I have since found a better way - the best. It is .NOT. my idea but one I got off the web.Here it is--
>
>Just before the slect all you have to do is set the RecordSource property of the grid to SPACE(0), do the select into the table and then set the RecordSource property back to the table.
>
>Thisform.Grid1.RecordSource = SPACE(0)
>Select .... into a_temp
>Thisform.Grid1.RecordSource = "a_temp"
>
>That is ALL.
>
>Many thanks to all who replied
>
>Bernard
Hi Bernard,
This is the most common method to do it but doesn't give the desired result all the time, especially where columncount might differ. In addition I would suggest setting columncount and all columns(ix).conrtolsource properties through a loop explicitly.
* Grid custom method resql
* select ... into table a_temp
with this
    .recordsource = "a_temp"
    .columncount=fcount("a_temp")
    for ix=1 to .columncount
	 	with .columns(ix)
			.controlsource = "a_temp."+field(ix)	 	
		endwith
    endfor
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform