>I have something very strange happening and am wondering if anyone else has experienced it.
>
>I am attempting to create a temporary table at runtime. If I run through the code like normal, my table does not get created. The thing that has me boggled is when I "set step on" the line prior to the "create table" line in the debugger, copy and paste the "create table" line to the Fox Command Window and execute the line from there, the table gets created.
>
>I have the following code in my VFP 5.0 application:
>
>*******************************************
>lcTableName = oapp.lctemp+'realtime.dbf'
>** 'oapp.lctemp' represents the runtime path, usually 'c:\temp\'
>CREATE TABLE &lcTableName free ;
This is likely to be the problem if the table name and path contain a space, as in oApp.lcTemp = 'C:\My Random Temp Directory' - guarenteed to misparse unless you do lots of defensive coding to avoid isssues of resolving the name cleanly. There is an easy way out - avoid macro expansion, and use name resolution rather than macro expansion:
CREATE TABLE (lcTableName) free ;
> (group C(50), name C(50), inst_id I(4), date D, time C(8) ;
You are totally suicidal - you realize you've used VFP reserved words for field names, one of which is also a very probable disaster because most base classes have 'name', and 'group' is likely to have things misparse when setting up SQL Selects. Your funeral, not mine, but avoid using VFP reserved words.
> ,serial C(10) ,oper C(6) ,var N(13, 5), attr C(15) ;
> ,min N(13, 5), aim N(13, 5), max N(13, 5) ;
MIN and MAX are almost guarenteed to create havoc, especially in SQL SELECTs, and macro expansion is going to eat you for lunch...
> ,llim1 N(13, 5), ulim1 N(13, 5), llim2 N(13, 5), ulim2 N(13, 5) ;
> ,llim3 N(13, 5), ulim3 N(13, 5), llim4 N(13, 5), ulim4 N(13, 5) ;
> ,llim5 N(13, 5), ulim5 N(13, 5), llim6 N(13, 5), ulim6 N(13, 5) ;
> ,llim7 N(13, 5), ulim7 N(13, 5), llim8 N(13, 5), ulim8 N(13, 5) ;
> ,comment M ,rslt_id C(6), reqt_id C(6), comp_occ C(15) ;
> , reqt_occ C(15))
>*******************************************
>
>Is there something I need to do differently to create the temporary table from my source?
>
>Thanks in advance for your help.
>
>P.S. I am creating many other temporary tables throughout my application the same way and haven't experienced this problem before.