by vinay nataraj (2 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 29th October 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Export Source Table from Current Database To The Destination Table In New Database ( IN ACCESS )
API Declarations
Dim AccesApp As Access.Application
Dim Newdatabasepath As String
Dim fso As FileSystemObject
Public Sub ExportTable(ByVal strCurrentdatabasepath As String, ByVal strNewDatabasePath As String, ByVal strSourceTableName As String, ByVal strDestinationTableName As String)
On Error GoTo errcheck:
'***********************************************************************************************************************************************************************************
Set fso = New FileSystemObject
If fso.FileExists(strCurrentdatabasepath) = False Then
MsgBox "Invalid Current DataBase"
Exit Sub
ElseIf fso.FileExists(strNewDatabasePath) = False Then
MsgBox "Invalid Destination Database"
Exit Sub
ElseIf strDestinationTableName = "" Or strDestinationTableName = " " Then
MsgBox "Please Eneter Destination TableName "
Exit Sub
ElseIf strSourceTableName = "" Or strSourceTableName = " " Then
MsgBox "Please Eneter Source TableName "
Exit Sub
End If
Set AccesApp = New Access.Application
Newdatabasepath = strNewDatabasePath
'Open and set the path for the current database
AccesApp.OpenCurrentDatabase strCurrentdatabasepath
'Export the Source table from current database to The Destination table in the back-up / new database
AccesApp.DoCmd.TransferDatabase acExport, "Microsoft Access", Newdatabasepath, acTable, strSourceTableName, strDestinationTableName
MsgBox "Table Successfully Exported"
'***********************************************************************************************************************************************************************************
AccesApp.CloseCurrentDatabase
AccesApp.Quit
Set AccesApp = Nothing
Set fso = Nothing
'***********************************************************************************************************************************************************************************
Exit Sub
errcheck:
MsgBox Err.Description
End Sub
No comments have been posted about Export Source Table from Current Database To The Destination Table In New Database ( IN ACCESS ). Why not be the first to post a comment about Export Source Table from Current Database To The Destination Table In New Database ( IN ACCESS ).