Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Joseph G. Njoroge
  Where is Joseph G. Njoroge?
 Nairobi
 Kenya
 Joseph G. Njoroge
 Tags
Subject: RE: Grid on a Form
Thread ID: 143618 Message ID: 143645 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Thursday, August 30, 2007 2:01:40 PM         
   


> Dear Experts,
> Am trying to view customers invoices whereby am selecting/typing required customer account on a combobox.Then setting filters to transaction file on the value returned from the combobox. I want the filtered records to populate the grid.
> attached find the form layout and also the on valid code am using. Please assist.
>
>
>
>
IF thisform.cboaccno.Value<>' ' THEN 
> 	thisform.waccname=customer.accname
> 	thisform.wpc=customer.proeng
> 	thisform.wdescript=customer.descript
> 	thisform.wcontract=customer.contract
> 		
> 	thisform.txtAccname.Value=thisform.waccname
> 	thisform.txtproeng.Value=thisform.wpc
> 	thisform.txtdescript.Value=thisform.wdescript
> 	thisform.txtcontract.Value=thisform.wcontract
> 	SELECT custtran
> 	SET FILTER TO ALLTRIM(accno)=ALLTRIM(thisform.wcboaccno)
> 	GO TOP 
> 	CREATE CURSOR custdetails (accno character(10),reference character(10),;
> 		invdate DATE, invoiced N(12,2),remark memo)
> 	SELECT custdetails	
> 	APPEND FROM custtran	
> ELSE
>  	thisform.txtaccname.Value=' '
>  	thisform.txtdescript.Value=' '
>  	thisform.txtProeng.Value=''
>  	thisform.txtcontract.Value=0.00
> ENDIF 

>
> Best Regards,
> Joseph G. Njoroge

No need for a filter and filtering grid records is a bad idea. You have much better options. One sample:

IF thisform.cboaccno.Value<>' ' THEN 
	thisform.waccname=customer.accname
	thisform.wpc=customer.proeng
	thisform.wdescript=customer.descript
	thisform.wcontract=customer.contract
		
	thisform.txtAccname.Value=thisform.waccname
	thisform.txtproeng.Value=thisform.wpc
	thisform.txtdescript.Value=thisform.wdescript
	thisform.txtcontract.Value=thisform.wcontract
ELSE
 	thisform.txtaccname.Value=' '
 	thisform.txtdescript.Value=' '
 	thisform.txtProeng.Value=''
 	thisform.txtcontract.Value=0.00
ENDIF 
WITH thisform.myGrid
	.RecordSource = .RecordSource
endwith


* Grid.init
WITH this
 .RecordSourceType = 4
 .RecordSource = "SELECT accno,reference,invdate, invoiced,remark"+;
		" FROM custttran"+;
		" WHERE accno==thisform.wcboaccno"+;
		" into cursor crsTran nofilter"
endwith


Cetin Basoz

ENTIRE THREAD

Grid on a Form Posted by Joseph G. Njoroge @ 8/30/2007 11:06:10 AM
RE: Grid on a Form Posted by tushar @ 8/30/2007 11:39:48 AM
RE: Grid on a Form Posted by Cetin Basoz @ 8/30/2007 2:01:40 PM
RE: Grid on a Form Posted by Joseph G. Njoroge @ 9/7/2007 10:44:22 AM
RE: Grid on a Form Posted by Cetin Basoz @ 9/7/2007 2:43:05 PM
RE: Grid on a Form Posted by Joseph G. Njoroge @ 9/8/2007 8:07:16 AM
RE: Grid on a Form Posted by Cetin Basoz @ 9/8/2007 8:22:15 AM
RE: Grid on a Form Posted by tushar @ 9/8/2007 8:27:27 AM
RE: Grid on a Form Posted by Cetin Basoz @ 9/8/2007 8:42:26 AM
RE: Grid on a Form Posted by Joseph G. Njoroge @ 9/8/2007 8:55:26 AM
RE: Grid on a Form Posted by Joseph G. Njoroge @ 9/10/2007 10:16:33 AM
RE: Grid on a Form Posted by Cetin Basoz @ 9/10/2007 1:53:44 PM