if you use DAO

VB Code:
  1. Private Sub Command1_Click()
  2.     Dim db As Database
  3.     Dim sDBFrom As String
  4.     Dim sDBTo As String
  5.     Dim td As TableDef
  6.     Dim sql As String
  7.    
  8.     sDBFrom = "C:\TEST\From.mdb"
  9.     sDBTo = "C:\TEST\To2.mdb"
  10.    
  11.    
  12.     'check to see if the database exist. if not create it.
  13.     If Dir(sDBTo) = "" Then
  14.         'database does not exist, make the database
  15.         Set db = CreateDatabase(sDBTo, dbLangGeneral, dbVersion40)
  16.         db.Close
  17.     End If
  18.    
  19.    'open the db where you want to get the data from
  20.     Set db = OpenDatabase(sDBFrom)
  21.  
  22.     'copy all the tables using SQL and Execute
  23.     For Each td In db.TableDefs
  24.         'make sure that you do not try to create the system tables,
  25.         'cause they will already be in the db
  26.         If UCase(Left(td.Name, 4)) <> "MSYS" Then
  27.             sql = "SELECT * INTO " & td.Name & " IN '" & sDBTo & "' FROM " & td.Name
  28.             db.Execute sql
  29.         End If
  30.     Next td
  31.    
  32.     'close the db
  33.     db.Close
  34. End Sub