Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Don Higgins
  Where is Don Higgins?
 Peoria
 Illinois - United States
 Don Higgins
 To: Khurram Tahir
  Where is Khurram Tahir?
 Karachi
 Pakistan
 Khurram Tahir
 Tags
Subject: RE: Select sql and grid
Thread ID: 104345 Message ID: 104821 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Monday, August 21, 2006 6:25:33 PM         
   


Here is a complete example from one of my forms. Replace my data info with your own. Do this EXACTLY AS I DESCRIBE, only replacing your data names:


First, you need a temporary cursor created in the Form's Load Event. In my example I create a cursor from an existing table. I call this cusor csrICard

The sole function of this cursor will be the CONTROL SOURCE for the grid.



FORM LOAD EVENT :::

CREATE CURSOR CsrIcard ( TIMESTAMP T(8), ;
SESSION C(40), ;
carclass C(20), ;
carnumber C(10), ;
drivername C(40), ;
ilane C(5), ;
idialin N(10,3), ;
ireaction N(10,3), ;
i60foot N(10,3), ;
iquarter N(10,3), ;
i1320mph N(10,3), ;
i60to1320 N(10,3), ;
i330to1320 N(10,3) )



Now that we have the control source for the grid we need to populate it. Marcia and Andy use a Custom Form Method called RESET. Create a custom Form Method called RESET on your Form.

Click on the Form Method Reset and in this code editing window put something similar to this:

* ::: Form Method RESET

SELECT TIMESTAMP, SESSION, carclass, carnumber, drivername,;
ilane, idialin, ireaction, i60foot, i330foot, ;
i660foot, i660mph, i1000foot, iquarter, i1320mph, ;
ioverunder, imargin, iwin ;
FROM icard WHERE ;
TIMESTAMP > 0 ;
ORDER BY TIMESTAMP DESC ;
INTO CURSOR csrtempicard &&nofilter

* did we get a returned cursor with records?

IF _TALLY > 0
* records exist

* Now zap the current records so we can fill
* them from the cursor CSRTEMPICARD select statement created above

* select the cursor we created in the LOAD EVENT

SELECT csricard

* clear out any existing records
ZAP

* add records from the select statement above
APPEND FROM DBF('CsrTempIcard')

* refresh form
thisform.refresh()
ENDIF




Don Higgins



ENTIRE THREAD

Select sql and grid Posted by Khurram Tahir @ 8/15/2006 9:55:34 AM
RE: Select sql and grid Posted by Jojo Sabino @ 8/15/2006 10:03:40 AM
RE: Select sql and grid Posted by Khurram Tahir @ 8/15/2006 12:40:17 PM
RE: Select sql and grid Posted by Andy Kramek @ 8/15/2006 12:41:46 PM
RE: Select sql and grid Posted by Khurram Tahir @ 8/15/2006 1:28:59 PM
RE: Select sql and grid Posted by tushar @ 8/15/2006 5:33:31 PM
RE: Select sql and grid Posted by Andy Kramek @ 8/16/2006 12:34:53 PM
RE: Select sql and grid Posted by Khurram Tahir @ 8/16/2006 12:44:54 PM
RE: Select sql and grid Posted by tushar @ 8/16/2006 1:23:42 PM
RE: Select sql and grid Posted by Andy Kramek @ 8/17/2006 12:43:57 PM
RE: Select sql and grid Posted by Don Higgins @ 8/21/2006 6:25:33 PM