CodeItBetter Programming Another VB Programming Blog

How to export data from the current database to a back-up database using Access Application

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'Database - How to export data from the current database to a back-up database using Access Application
Option Explicit
 
Dim appAccess As Access.Application
Dim dat As String
 
Sub BackUpDatabase()
    Set appAccess = New Access.Application
    dat = App.Path & "\BackUpDb.mdb"
 
    'Open and set the path for the current database
    appAccess.OpenCurrentDatabase App.Path & "\CurrentDb.mdb"
 
    'Creates a new table in the current database
    appAccess.DoCmd.RunSQL ("CREATE TABLE new_table (column1_name varchar, column2_name varchar)")
 
    'Populate the new table with the data selected from the old table in the same database
    appAccess.DoCmd.RunSQL ("INSERT INTO new_table SELECT column1_name, column2_name FROM old_table")
 
    'Export the new table from current database to Arhi table in the back-up database
    appAccess.DoCmd.TransferDatabase acExport, "Microsoft Access", dat, acTable, "new_table", "Test"
 
    MsgBox "Database created !"
 
    'Close the current database
    appAccess.CloseCurrentDatabase
 
    appAccess.Quit
End Sub

Related posts:

  1. How to copy data from an Access database into an Excel workbook using a Recordset
  2. How to Copy data from an Access database into an Excel spreadsheet
  3. How to Export an Access Database to HTML file
  4. How to Import SQL Server data into an Access database
  5. How to Use ADO to get data from a read-only Access database
  6. How to Copy data from an Access database into an Excel spreadsheet using a SQL SELECT statement
  7. How to Use Access data to make a Word table
  8. How to open a password protected access database using ADO
  9. How to use ADO to create a database table
  10. How to take data from a VB database application and place it into an Excel spreadsheet

Filed under: Database Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.