Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am confused . . .

Status
Not open for further replies.

WildSwan

Programmer
Mar 2, 2002
15
0
0
PH
While the snippet below works on command window of a FoxPro 2.6 (DOS), It generate "Feature not available." error when compiled as an Stand-alone EXE file.

*************************************************
cDBF_File = SYS(3)

CREATE TABLE &cDBF_File (code C(10), name C(40))
*************************************************

I am running out of ideas. I have to create a temporary DBF file which should be named uniquely because the program runs in a network environment.

For now I use FOX myexe.EXE so that the above code would work. But this doesn't work on all machines. Some will crash because of inadequate memory.

Any ideas guys?
 
Try using parenthesis instead of '&'

CREATE TABLE (cDBF_File) (code C(10), name C(40))
 
To create unique file name, is better create it as cursor,
especially on local machine.
Other possibility is command "copy to" or "copy stru":
cDBF_File = SYS(3)
CREATE TABLE MyTable(code C(10), name C(40))
copy to ("d:\tmp\"+cDBF_File+".dbf")
Tesar

 
Another problem is that SYS(3) creates a 'unique' number, which Fox interprets as a work area. (Fox needs table aliases to start with an alpha character). Since there isn't an 8 digit work area, you need to use something like:

cDBF_File = 'T' + RIGHT(SYS(3), 7)
CREATE TABLE &cDBF_File (code C(10), name C(40))
-or-
CREATE TABLE (cDBF_File) (code C(10), name C(40))
Dave S.
[cheers]
 
Thanks guys.

@Tesar
Your suggestion is good but I can't implement it. The structure I need is dynamic. It need to chage depending on conditions that my program arise into.

@Dave
I still get the same problem when the program is in EXE. Feature not available. :(

Even if I do this:

cDBF_File = "WILDSWAN"

CREATE TABLE &cDBF_File (code C(10), name C(40))
 
If you use brackets () you won't get the error 'Feature not available'

This:
CREATE TABLE &cDBF_File (code C(10), name C(40))

should be:
CREATE TABLE (cDBF_File)(code C(10), name C(40))
 
@Mlv1055
&cDBF_File, (cDBF_File) and EVALUATE(cDBF_File), they all give me the "Feature not available error." Actually the EVALUATE() is the most fastest among the three.

But guys, I did this and no more error!

************************************************
cDBF_File = SYS(3)
CREATE TABLE &cDBF_File (code C(10), name C(40))
USE &cDBF_File ALIAS LocalAlias
************************************************

Thanks for all your responses guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top