Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get result from 3 tables
Message
 
 
To
10/02/2011 01:19:01
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01499447
Message ID:
01499596
Views:
27
See the change I made in your code:

>thank you for reply,
>i try it no result
if LEN(ALLTRIM(thisform.text25.value)) >= 3
lcFormValue = trim( Thisform.text25.Value )
THISFORM.TEXT10.Value=lcFormValue
WAIT

  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( "<<lcFormValue>>", 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
>
>
>
>>I would additionally textmerge your "thisform.text25.value" in the SQL-Select. When the SQL processes it is expecting queries based on a table.field basis. When you throw at it a thisform.text25.value it sometimes gets confused... You might want to change like
>>
>>lcFormValue = trim( Thisform.text25.Value )
>>
>>then in your WHERE,
>>
>>WHERE ATC( "{{lcFormValue}}", SDISC ) > 0
>>
>>(using curly brackets above for post... prevented from using angled brackets)
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform