>I have an application that I wish to allow users to create a duplicate of the databases and tables. For example a multi office application where the underlying information is completely different but the dbc/tables/application are exactly the same. I have coded to allow the users to select between datasets by creating separate subdirectories and datasets beneath the application main directory. Now I want to programatically copy the database & related tables to a subdirectory if a user wants to add a new office to their application.
>
>In order to maintain system integrity I want to have a unique name for each new database so I copy the database and related tables then rename it. I can easily validate the new database with "recover" through the command prompt then manually reply 'yes' to resolve the back link messages but I would like to automate this process so it is invisible to the users.
>
>Does anyone know of a way that I can accomplish this? I have tried using the ON ERROR to return a "YES" (6) then calling Validate Recover, but the validate routine seems to ignore this. I assume it's not actually generating an error but a message.
Another general approach might be to use the GenDBC program. When you run this against your original database it creates a program (e.g. "BuildMyDBC.prg") that, when itself run, can re-create your database. It might be possible to modify BuildMyDBC.prg to reflect the new name required.
As an alternative it's probably possible to use low-level file functions and programmatically modify file headers in tables to point to a differently-named .DBC. I don't know how to do that but you might find the answer by searching through threads here.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up