Thanks and big shout out to all those who are helping me.
Access Objects are the Tables, Queries, Forms, Reports, Macros, Store Procedure and Functions that builds up a Database. What am looking for is the complete deletion of the Access Objects in the database and replaced by the Access Objects from the BackUp file.
Arnelgp Codes below imports Tables from the Backup file and add up to the blank Tables in the Database which produces a bug dialog box with the inscriptions " Tables are already in the objects". This means that there should a total deletion to the existing Access objects and replaced by those Access Objects in the Backup file.
Please, help me edit this.
Private Sub do_restore()
Const SQL_STRING As String = "SELECT * INTO <table> FROM <table> IN '<externDB>';"
Dim db As DAO.Database
Dim td As DAO.TableDef
Dim strSQL As String
'* open External database
Set db = OpenDatabase(Me.txtFile, False, False)
For Each td In db.TableDefs
If Left(td.Name, 4) <> "MSys" And Left(td.Name, 1) <> "~" Then
strSQL = Replace(SQL_STRING, "<table>", td.Name)
strSQL = Replace(strSQL, "<externDB>", Me.txtFile)
CurrentDb.Execute strSQL
End If
Next
db.Close
Set db = Nothing
Application.RefreshDatabaseWindow
End Sub
Access Objects are the Tables, Queries, Forms, Reports, Macros, Store Procedure and Functions that builds up a Database. What am looking for is the complete deletion of the Access Objects in the database and replaced by the Access Objects from the BackUp file.
Arnelgp Codes below imports Tables from the Backup file and add up to the blank Tables in the Database which produces a bug dialog box with the inscriptions " Tables are already in the objects". This means that there should a total deletion to the existing Access objects and replaced by those Access Objects in the Backup file.
Please, help me edit this.
Private Sub do_restore()
Const SQL_STRING As String = "SELECT * INTO <table> FROM <table> IN '<externDB>';"
Dim db As DAO.Database
Dim td As DAO.TableDef
Dim strSQL As String
'* open External database
Set db = OpenDatabase(Me.txtFile, False, False)
For Each td In db.TableDefs
If Left(td.Name, 4) <> "MSys" And Left(td.Name, 1) <> "~" Then
strSQL = Replace(SQL_STRING, "<table>", td.Name)
strSQL = Replace(strSQL, "<externDB>", Me.txtFile)
CurrentDb.Execute strSQL
End If
Next
db.Close
Set db = Nothing
Application.RefreshDatabaseWindow
End Sub