Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get result from 3 tables
Message
From
09/02/2011 14:18:01
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Get result from 3 tables
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01499447
Message ID:
01499447
Views:
77
hi all,

i need help to fix this code to get data from 3 tables, or onther way
if LEN(ALLTRIM(thisform.text25.value)) >= 3
  for i=1 to 3
    cAlias = ICASE(i=1,'mstr2010',i=2,'mstr2001','mstr2011')
  text to cSQL noshow pretext 15 TEXTMERGE
SELECT no,img1 ,EXPBDATE,SDISC,STYPE,ansdisc,expbno from <<cAlias>> 
WHERE atc(trim(thisform.text25.value) ,SDISC)>0 
  INTO cursor TAliascursor1 readwrite
ENDTEXT
&cSQL
		thisform.Grid2.RecordSource=" TAliascursor1" 
			IF i = 1 AND _Tally # 0  
			  thisform.Grid2.RecordSource="TAliascursor1"
			  thisform.grid2.visible=.t.
			  thisform.grid2.enabled=.t.
			  thisform.edit2.visible=.t.
			 EXIT 
		ENDIF 
		IF i= 2 AND _Tally # 0  
			   MESSAGEBOX("Found !!")
			   thisform.Grid2.RecordSource="TAliascursor1"
			  thisform.grid2.visible=.t.
			  thisform.grid2.enabled=.t.
			  thisform.edit2.visible=.t.
			 EXIT 
			 endif
			 IF i= 3 AND _Tally # 0  
			   MESSAGEBOX("Found !!")
			   thisform.Grid2.RecordSource="TAliascursor1"
			  thisform.grid2.visible=.t.
			  thisform.grid2.enabled=.t.
			  thisform.edit2.visible=.t.
			 EXIT 	
			 	
		ELSE
			   thisform.grid2.visible=.f.
			  thisform.grid2.enabled=.f.
			  thisform.edit2.visible=.f.
			  * MESSAGEBOX("Not Found")
		 ENDIF
		
	NEXT 
ENDIF
thanks
Next
Reply
Map
View

Click here to load this message in the networking platform