Using a table called DATADICT, it is possible in xBase languages to open a file without knowing the name of the file.  For example:

use &cFilename.                                       {Evaluates at runtime to:  CUSTOMER}

One responded pointed out that I could use a generic table component and simply put the filename from the data dictionary into the Table.Name property, yet I would prefer to use the table components in my data module.  In xBase syntax, I guess it would look something like this:  

  sTblName := string;

  sTblName := datamod.tblDataDict['TABLNAME'];      {where this field contains 'tableCustomer'}

Perhaps this is simply not possible in Object Pascal....:)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I will try to pull myself back to the evil days of Clipper...Anyway depending on just what DATADICT->FILENAME is returning you would do this

I think DATADICT->FILENAME is the field filename in the table DataDict...right??? oh well that's what I will take it for

so do this

if Table1.Active then Table1.Active := False;
Table1.TableName := tbDataDict.FieldByName('FileName').AsString;
Table1.Active := True;

You will propbably also want to go into foxpro and type in this
delete all for database = sucky
pack  :)

roncmAuthor Commented:
Sorry, no help....
roncmAuthor Commented:
Edited text of question
What you are trying to do is not possible in object pascal. What you have to do is:

- for each table you want to open drop a TTable component on your datamodule (comparabal to each USE clause in clipper)

- Open your datadict table

Assign the Tablename propery:
if your filename contains a path use Extractfilename(filename) to extract the real filename.
Table1.TableName := tbDataDict['FileName']

Assign the Databasename property to the directory where your table resides (comparabal to set_default in clipper)
Call the table open method or set active to true

By the way, using a macro expansion in clipper takes a lot of time. Better is: USE (FileName) SHARED ...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
roncmAuthor Commented:
Not possible.  I thought so.  Thanks jhunt...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.