
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.