backup

Status
Niet open voor verdere reacties.

bonnowagt

Gebruiker
Lid geworden
7 dec 2006
Berichten
445
Ik heb in mijn programma deze VB code staan voor Backup van het programma:

De backup wordt nu weggeschreven naar hetzelfde path:. Graag zou ik een keuze krijgen waarheen ik de backup kan schrijven, bijv. nar mijn USB stick.

Dit zit waarschijnlijk in de volgende code:
sFolderBup = Application.CurrentProject.Path & "\Backup\"
Hoe pas ik dit aan?

De code is:
Private Sub Wisselknop4_Click()
Dim fileObj As Object
Dim strFileName As String
Dim strBackupName As String
Dim msg As Integer
Dim sFolderBup As String
strFileName = "quiz.mdb"
strBackupName = Format$(Now(), "yyyymmdd") & strFileName
sFolderBup = Application.CurrentProject.Path & "\Backup\"
If Len(Dir(sFolderBup, vbDirectory)) = 0 Then MkDir sFolderBup
strFileName = Application.CurrentProject.Path & "\" & strFileName
strBackupName = Application.CurrentProject.Path & "\Backup\" & strBackupName


Set fileObj = CreateObject("scripting.filesystemobject")
fileObj.CopyFile strFileName, strBackupName, True

DoCmd.OpenForm "succesvolbackup"
Exit Sub
Failed_backup:
msgbox "Backup is niet gelukt!", vbCritical
 
Probeer eens het commando Filecopy of compactdatabase.

Ook daarmee kan je een bestand copieren

HTH:D
 
Status
Niet open voor verdere reacties.

Nieuwste berichten

Terug
Bovenaan Onderaan