i have this code for backup but it only backups files in a directory, don´t backup the directorys inside the directory of backup (Me!ActivePath)
On Error GoTo Backup_Error
Dim strRootPath
Dim strFilename
Dim strDefaultName As String
Dim strActivePath As String
Dim strBckupPath As String
Dim strBckupName As String
Dim objScript
Dim strdate
Dim strMonth
Dim strDay
Dim strYear
Dim strSource
Dim strTarget
strDefaultName = "YieldnDowntimeBckup_"
Set objScript = CreateObject("Scripting.FileSystemObject"
strMonth = DatePart("m", Date)
If Len(strMonth) = 1 Then strMonth = "0" & strMonth
strDay = DatePart("d", Date)
If Len(strDay) = 1 Then strDay = "0" & strDay
strYear = Right(DatePart("yyyy", Date), 4)
strdate = strDay & "_" & strMonth & "_" & strYear
If IsNull(Me!ActivePath) Or IsNull(Me!BckupPath) Then
MsgBox "Backup Failed - Paths of Databases are not specified.", vbCritical + vbOKOnly, "Path Not Specfied"
End 'geraldino
Else
strActivePath = Me!ActivePath
strBckupPath = Me!BckupPath
strRootPath = strActivePath & "\"
strSource = strRootPath & "*.*"
If IsNull(Me!Name) Then
strTarget = strBckupPath & "\" & strDefaultName & strdate & "\"
If Not objScript.FolderExists(strTarget) Then
objScript.CreateFolder (strBckupPath & "\" & strDefaultName & strdate & "\"
End If
objScript.CopyFile strSource, strTarget
Set objScript = Nothing
Else
strBckupName = Me!Name
strTarget = strBckupPath & "\" & strBckupName & "_" & strdate & "\"
If Not objScript.FolderExists(strTarget) Then
objScript.CreateFolder (strBckupPath & "\" & strBckupName & "_" & strdate & "\"
End If
objScript.CopyFile strSource, strTarget
Set objScript = Nothing
End If
End If
Backup_Exit:
Exit Sub
Backup_Error:
If Err = 76 Then
MsgBox ("Put your custom message here"
Me![TextBoxName].SetFocus 'returns focus to control with the problem
End If
GoTo Backup_Exit
End Sub
On Error GoTo Backup_Error
Dim strRootPath
Dim strFilename
Dim strDefaultName As String
Dim strActivePath As String
Dim strBckupPath As String
Dim strBckupName As String
Dim objScript
Dim strdate
Dim strMonth
Dim strDay
Dim strYear
Dim strSource
Dim strTarget
strDefaultName = "YieldnDowntimeBckup_"
Set objScript = CreateObject("Scripting.FileSystemObject"
strMonth = DatePart("m", Date)
If Len(strMonth) = 1 Then strMonth = "0" & strMonth
strDay = DatePart("d", Date)
If Len(strDay) = 1 Then strDay = "0" & strDay
strYear = Right(DatePart("yyyy", Date), 4)
strdate = strDay & "_" & strMonth & "_" & strYear
If IsNull(Me!ActivePath) Or IsNull(Me!BckupPath) Then
MsgBox "Backup Failed - Paths of Databases are not specified.", vbCritical + vbOKOnly, "Path Not Specfied"
End 'geraldino
Else
strActivePath = Me!ActivePath
strBckupPath = Me!BckupPath
strRootPath = strActivePath & "\"
strSource = strRootPath & "*.*"
If IsNull(Me!Name) Then
strTarget = strBckupPath & "\" & strDefaultName & strdate & "\"
If Not objScript.FolderExists(strTarget) Then
objScript.CreateFolder (strBckupPath & "\" & strDefaultName & strdate & "\"
End If
objScript.CopyFile strSource, strTarget
Set objScript = Nothing
Else
strBckupName = Me!Name
strTarget = strBckupPath & "\" & strBckupName & "_" & strdate & "\"
If Not objScript.FolderExists(strTarget) Then
objScript.CreateFolder (strBckupPath & "\" & strBckupName & "_" & strdate & "\"
End If
objScript.CopyFile strSource, strTarget
Set objScript = Nothing
End If
End If
Backup_Exit:
Exit Sub
Backup_Error:
If Err = 76 Then
MsgBox ("Put your custom message here"
Me![TextBoxName].SetFocus 'returns focus to control with the problem
End If
GoTo Backup_Exit
End Sub