>>if [<< var >>] worked and [?var] not, then usually the variable is out of scope (or is redefined somewhere). >>>
>PRIVATE cDep, cCat, cItem >cDep = EVL(substr(lcViewVar,1,10),NULL) >cCat = EVL(substr(lcViewVar,11,10),NULL) >cItem = EVL(substr(lcViewVar,21,10),NULL) > >TEXT TO lcS TEXTMERGE noshow >SELECT * FROM ItemFund >where department = ?m.cDep and Category = ?m.cCat and Item = ?m.cItem >endtext > >mysqlexec(m.lcS, 'csrItemfund', program()) >select csrItemfund >if reccount() = 0 > append blank >endif > >TEXT TO lcS noshow >SELECT * FROM i_invent >where department = ?m.cDep and Category = ?m.cCat and Item = ?m.cItem >endtext > >mysqlexec(m.lcS, 'i_invent', program()) > >make_view_updatable('i_invent',5) &&table buffering > >TEXT to lcS NOSHOW >if object_id('tempdb..#csrI_Item') is not null drop table #csrI_Item >select * > into #csrI_Item > from i_items > where department = ?m.cDep > and category = ?m.cCat > and item = ?m.cItem >SELECT * from #csrI_Item >ENDTEXT > >mysqlexec(m.lcS, 'i_items', PROGRAM()) > >TEXT to lcS NOSHOW > >select * from i_attlnk WHERE invent_id in (select invent_id FROM #csrI_Item) >DROP TABLE #csrI_Item >ENDTEXT >mysqlexec(m.lcS, 'i_attlnk', PROGRAM()) >Check with SQL Profiler what is the query sent to sql server.