Copy table schema and data from one DB to another DB 
Author Message
 Copy table schema and data from one DB to another DB

I am looking for suggestions on how to proceed in writing
a VB 6 program to copy (data & schema) from one Access
2000 .mdb to another Access .mdb.


Sun, 26 Dec 2004 23:39:03 GMT  
 Copy table schema and data from one DB to another DB


Fri, 19 Jun 1992 00:00:00 GMT  
 Copy table schema and data from one DB to another DB
I think the best way to do what I want is something like
below.  It works fine except I need to have the original
DB have an Access DB password.  How do I do this?

Dim strOldDBPathName As String
Dim kmd As ADODB.Command

strOldDBPathName = App.Path & "\db1.mdb"

Set kmd = New ADODB.Command
With kmd
   .ActiveConnection = cn2.ConnectionString
   .CommandText = "SELECT * INTO tblNew" _
      & " FROM tblOccurrences IN '" & strOldDBPathName
& "'"
   .Execute
End With

Quote:
>-----Original Message-----
>I am looking for suggestions on how to proceed in writing
>a VB 6 program to copy (data & schema) from one Access
>2000 .mdb to another Access .mdb.



Mon, 27 Dec 2004 02:58:22 GMT  
 Copy table schema and data from one DB to another DB
Hi Rb,

I was thinking about that but there are some issues here.SELECT * INTO ...
makes a copy of table's structure and copies all data, but does not copy
indexes and other staff related to relationships. You would need to make
them separately, if you need.

If you need to open original database, which protected with password, then
you would need to construct next kind of connection string

MyConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\MyTelBook\MyTelBook.mdb;Jet OLEDB:Database Password=Diamond;",
"Username", "Password"

--
Val Mazur
Microsoft MVP


Quote:
> I think the best way to do what I want is something like
> below.  It works fine except I need to have the original
> DB have an Access DB password.  How do I do this?

> Dim strOldDBPathName As String
> Dim kmd As ADODB.Command

> strOldDBPathName = App.Path & "\db1.mdb"

> Set kmd = New ADODB.Command
> With kmd
>    .ActiveConnection = cn2.ConnectionString
>    .CommandText = "SELECT * INTO tblNew" _
>       & " FROM tblOccurrences IN '" & strOldDBPathName
> & "'"
>    .Execute
> End With

> >-----Original Message-----
> >I am looking for suggestions on how to proceed in writing
> >a VB 6 program to copy (data & schema) from one Access
> >2000 .mdb to another Access .mdb.



Mon, 27 Dec 2004 03:33:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to copying from one DB table to another DB table

2. Copying Tables from one DB to another DB

3. Copy table from one db to another db with vb5

4. Copy Access/Oracle table from one DB to another DB.

5. Copying data from one DB to another DB

6. Copy Data Structures no data DB to DB

7. Copy Recordset from one Db to a different Db

8. Using MS Data Shaping with OLE DB - data from more than one table in mpp file

9. How to copy table from DB to DB?

10. copy runtime a table from db a to db b

11. Copying table from DB to DB in VB

12. Copy a table from one db to another

 

 
Powered by phpBB® Forum Software