Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.TransferDatabase does not work with Access - Runtime-version

Status
Not open for further replies.

iltis

Programmer
Oct 27, 2002
1
DE
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top