Just a newbie question that I didnt found anywhere.

How can I retrieve all the tables with a SELECT command I mean, whats the name of the table holding all that info

Re: Retrieving tables


If all the tables are not in a database (DBC) there is no table holding that info. VFP is a file based system, that means you can check a folder's content for files with an extension "dbf" to get the table list ( "dbf" is the default extension for a table and a table need not be absolutely have that extension).

Now assuming you meant to get tables in a database here is a sample:

Code Snippet

open database (_samples+'data\testdata')

for ix=1 to adbobjects(arrTables,'TABLE')



Re: Retrieving tables


You may find only available work area with function SELECT().

"SELECT( ) returns the number of the current work area if SET COMPATIBLE is set to OFF. If SET COMPATIBLE is set to ON, SELECT( ) returns the number of the unused work area with the highest number."

You may also use ALIAS() to find the current work area.

Re: Retrieving tables



If you are want them in an array, you can use the Adir() function also. For example

Code Snippet


FOR m.ct=1 TO m.file_ct


NEXT m.ct

The above code will print all the DBF (tables) file names in the current directory. you can switch the current directory with set default to <dir name> / cd commands.

Best regards,