Back up all tables to another database

veerachai

New member
Local time
Tomorrow, 06:27
Joined
Jul 11, 2006
Messages
6
I would like to transfer all existing tables (only table, to save space) on my present database to another database for back up, by let program check and type out all table names by there own, no need for me to type one by one under fixed name.

Can someone help give me code

Best Rgds
VJ
 
Finally I found correct coding
PHP:
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click

Dim BUpath As String
Dim obj As AccessObject, dbs As Object, PRname As String

BUpath = Application.CurrentProject.Path & "\Ritcha BU.mdb"
MsgBox "Program will start Back up Tables at " & BUpath

Set dbs = Application.CurrentData
For Each obj In dbs.AllTables
PRname = obj.Name
If PRname <> "MSysAccessObjects" And PRname <> "MSysACEs" And PRname <> "MSysACEs" _
And PRname <> "MSysObjects" And PRname <> "MSysQueries" And PRname <> "MSysRelationships" Then
DoCmd.TransferDatabase acExport, "Microsoft Access", BUpath, acTable, PRname, PRname, False
End If
Next obj

MsgBox "All Tables on Database already backed up"

Exit_Command33_Click:
    Exit Sub
Err_Command33_Click:
    MsgBox Err.Description
    Resume Exit_Command33_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom