On a form the user can restore data from a database which contains all the tables of the original database. This is done by:
Sub Restore_Click()
On Error go to Fehlerbehandlung_Restore
Dim Name, Cancle As Boolean
Name = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) + "SDV\Sicherung.mdb"
If Dir(Name) = "" then
MsgBox "Sicherungsdatei nicht vorhanden!",vbCritical,"Abbruch"
Cancel = True
end if
DoCmd.TransferDatabase acImport, "Microsoft Access", Name, acTable, "Lehrkräfte", "Lehrkräfte"
' ... several tables following
' because tables allready exist, Access saves them as "Lehrkräfte1",...
' rename Lehrkräfte1 to Lehrkräfte an replace old table with backup:
DoCmd.SetWarnings False
DoCmd.Rename "Lehrkräfte", acTable, "Lehrkräfte1"
'... several tables following
DoCmd.SetWarnings True
Benden:
Exit Sub
Fehlerbehandlung_Restore:
Msgbox Err.Description
Resume Beenden
End Sub
This works fine with the full version (Access 2000) - but produces a crash of the program with the runtime-version (Access 2002).
The procedure to export the data into the backup-database "Sicherung.mdb" works in both situations.
Any helpfull hints are welcome! (Hope the English is not too bad)
Erhard
Sub Restore_Click()
On Error go to Fehlerbehandlung_Restore
Dim Name, Cancle As Boolean
Name = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) + "SDV\Sicherung.mdb"
If Dir(Name) = "" then
MsgBox "Sicherungsdatei nicht vorhanden!",vbCritical,"Abbruch"
Cancel = True
end if
DoCmd.TransferDatabase acImport, "Microsoft Access", Name, acTable, "Lehrkräfte", "Lehrkräfte"
' ... several tables following
' because tables allready exist, Access saves them as "Lehrkräfte1",...
' rename Lehrkräfte1 to Lehrkräfte an replace old table with backup:
DoCmd.SetWarnings False
DoCmd.Rename "Lehrkräfte", acTable, "Lehrkräfte1"
'... several tables following
DoCmd.SetWarnings True
Benden:
Exit Sub
Fehlerbehandlung_Restore:
Msgbox Err.Description
Resume Beenden
End Sub
This works fine with the full version (Access 2000) - but produces a crash of the program with the runtime-version (Access 2002).
The procedure to export the data into the backup-database "Sicherung.mdb" works in both situations.
Any helpfull hints are welcome! (Hope the English is not too bad)
Erhard