Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing parameter in Query
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00823263
Message ID:
00823271
Views:
23
There's no reason to use macro substuton in this case. Use SET DELETE ON setting so you wouldn't need NOT DELETED() in your select. Anyway you cannot use NOT DELETED() in multi-table select because it may produce incorrect or unexpected results.
LOCAL mmIN,LY,XACT,XTM,Q
actualtabletahunan = 'ATRJLN03'    &&====>yearly table (dynamic)
XACT = maproot+"tables\" + actualtabletahunan
XTM = maproot + "tables\vrtm_actualjalan"

SELECT DISTINCT va.* ;
	FROM (XACT) at ;
	INNER JOIN (XTM) va ON ac.k_insp = va.k_insp ;
	WHERE MONTH(va.tgl_Act) = ALLTRIM(STR(nbulan)) ;
		AND YEAR(va.tgl_act) = ALLTRIM(STR(ntahun)) ;
		AND va.PT = ALLTRIM(KODEPT) ;
	ORDER BY va.K_insp ;
	INTO TABLE tables\reports\rt_progresjalan.dbf
>Guys
>i have trouble in querying data..
>I want to pass parameter in it...
>this is the samples..
>
>
>LOCAL mmIN,LY,XACT,XTM,Q
>actualtabletahunan = 'ATRJLN03'    &&====>yearly table (dynamic)
>MMin = actualtabletahunan+".k_insp"
>LY = "vrtm_Actualjalan.k_insp"
>XACT =maproot+"tables\&actualtabletahunan"
>XTM=maproot+"tables\vrtm_actualjalan"
>Q="SELECT DISTINCT vrtm_actualjalan.* FROM "+XACT+" INNER JOIN "+XTM+;
>" ON "+MMIN+" = Vrtm_actualjalan.k_insp WHERE !DELETED() 
AND MONTH(Vrtm_actualjalan.tgl_Act)="+;
>ALLTRIM(STR(nbulan))+" AND YEAR(Vrtm_actualjalan.tgl_act)=
"+ALLTRIM(STR(ntahun))+" AND vrtm_actualjalan.PT='"+;
>ALLTRIM(KODEPT)+"' ORDER BY vrtm_actualjalan.K_insp 
INTO TABLE tables\reports\rt_progresjalan.dbf"
>
>&Q
>
>
>
>With that kind of query it did works in designer
>
>but after i compile it...
>
>It become error in '&Q', says command unrecognize......
>
>How to fix the problem...
>thx...
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform