This is one of those things that can be done, but involves what I call a
"Fiddle-Factor" (hacks, etc), mainly because the DE was designed to be a
'design-time' design tool, with poor support for 'runtime' changes.
For one thing the DE does much of its initialization based on its initial
design-time properties before most of the average VB apps are even ready to
run.
Second, the database you redirect to must match the structure of the
original - some differences are tolerated, many are not.
The 'basic' scenario:
Say you designed DE using a Jet-formated database (.mdb) but at runtime
wanted to redirect to SQL Server. Create a 'dummy' mdb file - it only needs
the tables, fields, etc. that matches the original's structure. You don't
have to include data.
Private Sub DE_Initialize()
DE.MyConnection.ConnectionString = <"Connection String to the dummy
file">
DE.MyConnection.Open ' open it
DE.MyConnection.Close ' close it
DE.MyConnection.Provider = <"OLE DB provider for SQL Server">
DE.MyConnection.ConnectionString = <"connection string to new
datasource">
I believe that opening then closing the DE Connection closes and removes all
internal Commands, etc.
If you get "Invalid use of Property" error, or errors about "Invalid
Provider", etc. Then *Fiddle* with code location, providers, and database
structure until something works. <g> If we knew more about your particular
Problem Domain we might be more helpful, but in general it is usually a
matter of playing with the above.
Also consider using a UDL file to define the connection strings. This won't
make any real difference to the ability to redirect, but does simplify the
developement and distribution a bit.
hth
-ralph
-ralph
As I try to run in the server destination with the following path
\\servername\dir1\bd.xxx and the same database fails me "does not validate
operation in a closed component does not connect.
please excuse my English
"Ralph" wrote:
> .
>
"Ralph" wrote:
> .
>