Hi Gar,
If you're seeking for a workaround, there is a simple one:
in a scan loop instead of executing your commands, just create a string with commands, e.g.
local lcStr
lcStr=''
scan
lcStr=lcStr+"create view ..."+chr(13)
endscan
strtofile(lcStr, 'CreateViews.prg')
compile CreateViews
do CreateViews
I can not help with the problem itself, though...
>I have a program that uses cascading views. View 2 is a select from view 1, and view 3 from view 2 and so on. (Currently this uses 9 views.)
>
>I use a program to initially create the views. If I code it literally:
>
>
>Create SQl View FirstViewName as select * from anytable
>
>
>it works fine.
>
>But if I store the select and viewname in a table and create the views via the macro command in a loop while scanning the table:
>
>scan
> lc_viewname=valviews.viewname
> lc_code=valviews.viewcode
>
> CREATE SQL VIEW &lc_viewname AS &lc_code
> Use (lc_viewname) in 0 && because the next view created needs this one open
>endscan
>
>
>It works fine the first few tries through the loop, then starts behaving in funky ways -- browsing the results on the screen when the view is opened,
>trying to open the view designer, evenentually if error messages are ignored enough give the c0005 error. It does seem that the views that collapse, though fairly simple all have some modest level of complexity -- joins, group by, order by --something beyond a simple where clause.
>
>This happens under win2000 and NT 4.x both...
>
>It happens under SP3, and sp4 of VFP.
If it's not broken, fix it until it is.
My Blog