>For the method by program a function, How to do that? Can you show my an example?
PROCEDURE OpenTable
lparameters lcMyTable
if !empty(gcDatabaseName)
SET DATABASE TO (gcDatabaseName)
ELSE
SET DATABASE TO ("\data\MyDatabase.DBC")
endif
select 0
use (lcMyTable) again shared
ENDPROC
You may improve it to open table with special alias, buffering etc.
Note that you should define public variable gcDatabaseName in startup program. Than, when you switch to another database, just assign datbase name/path to that variable. In your forms use 'OpenTable("TableName")' in the Load event to open table.
>
>For the method 'SET DEFAULT TO', As the program files and the data files are put at the different directory. Will altering the Default directory cause program error for the exe file unlocated?
No. When you compile application into EXE file, commands like 'do MyProcedure.PRG' or 'DO FORM MyForm.scx' will automatically take program files from EXE file. You do not need to put program files with data, just EXE and data only.
HTH
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.