How to connect to 2 mdb files with one Data control at run time? 
Author Message
 How to connect to 2 mdb files with one Data control at run time?

Dear All,
vb6.
Data1.DatabaseName = "C:\Database2008.mdb" when the Form1 is loaded. I want
to change the name of Data1.DatabaseName to "C:\Database2009.mdb" when I
click on Command1 at run time. I tried to rename the Data control:
Data1.DatabaseName = "C:\Database2009.mdb"
but it does not read from the Database2009.mdb as the results are still read
from the Database2008.mdb. The Data1.RecordSource is the same name at all
time.
Any idea what else I need to do to instruct the data control to connect to
the other mdb file? Or, should I add a new Data control to the Form1 for the
Database2009?
Thanks for your comments in advance.
DORI


Wed, 22 Jun 2011 09:54:01 GMT  
 How to connect to 2 mdb files with one Data control at run time?

Quote:
> Dear All,
> vb6.
> Data1.DatabaseName = "C:\Database2008.mdb" when the Form1 is loaded. I
> want
> to change the name of Data1.DatabaseName to "C:\Database2009.mdb" when I
> click on Command1 at run time. I tried to rename the Data control:
> Data1.DatabaseName = "C:\Database2009.mdb"
> but it does not read from the Database2009.mdb as the results are still
> read
> from the Database2008.mdb. The Data1.RecordSource is the same name at all
> time.
> Any idea what else I need to do to instruct the data control to connect to
> the other mdb file? Or, should I add a new Data control to the Form1 for
> the
> Database2009?
> Thanks for your comments in advance.

Use the Refresh method.


Wed, 22 Jun 2011 11:07:07 GMT  
 How to connect to 2 mdb files with one Data control at run time?


Wed, 18 Jun 1902 08:00:00 GMT  
 How to connect to 2 mdb files with one Data control at run time?
Dear expvb,
Thank you so much for answering my question.
Happy New Year!
DORI
Quote:



> > Dear All,
> > vb6.
> > Data1.DatabaseName = "C:\Database2008.mdb" when the Form1 is loaded. I
> > want
> > to change the name of Data1.DatabaseName to "C:\Database2009.mdb" when I
> > click on Command1 at run time. I tried to rename the Data control:
> > Data1.DatabaseName = "C:\Database2009.mdb"
> > but it does not read from the Database2009.mdb as the results are still
> > read
> > from the Database2008.mdb. The Data1.RecordSource is the same name at all
> > time.
> > Any idea what else I need to do to instruct the data control to connect to
> > the other mdb file? Or, should I add a new Data control to the Form1 for
> > the
> > Database2009?
> > Thanks for your comments in advance.

> Use the Refresh method.



Wed, 22 Jun 2011 11:23:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Problems with ADO Data Control connecting to a Password Protected MDB

2. Connecting to a Password Protected MDB using the ADO Data Control

3. SQL Linking data from 2 MDB files into one recordset

4. ADO Data Control - Design Time/Run Time database locations

5. Reading MDB files at run time

6. Data Environment / Data Report / Changing database file at run time

7. Setting Data Definition file data source at run time

8. Moving controls from one form to another at run time

9. Connecting a Data Control to a Recordset running on a DCOM-Server

10. getting run-time behavior of a contained control in a user control at design time

11. Q - Switching MDB files with Data Control

12. VB6 Data control does not recognise access 2K mdb files

 

 
Powered by phpBB® Forum Software