27-06-16, 01:22 AM
السلام عليكم
كيف اجعل كود اخذ نسخة الاحتياطية لقاعدة البيانات ينسخ من غير ما تظهر رسالة تأكيد استبدال لقاعدة البيانات
الكود هو :
كيف اجعل كود اخذ نسخة الاحتياطية لقاعدة البيانات ينسخ من غير ما تظهر رسالة تأكيد استبدال لقاعدة البيانات
الكود هو :
كود :
On Error Resume Next
Dim SourceDir As String
Dim DestDir As String
Dim DatabaseFile As String
Dim DistanationFile As String
Dim Source As String
Dim Destination As String
'find out if there is file selected
If File1.FileName = "" Then
MsgBox "ÝÖáÇ Þã ÇæáÇ ÈÊÍÏíÏ ÇáãáÝ ", vbOKOnly, "áÇ íæÌÏ ãáÝ ãÍÏÏ"
Exit Sub
End If
DatabaseFile = File1.FileName
If Len(Dir1.Path) > 3 Then 'not a root directory
SourceDir = Dir1.Path & "\"
Source = SourceDir & DatabaseFile
Else
SourceDir = Dir1.Path
Source = SourceDir & DatabaseFile
End If
'if the want to append text to filename
If Check3.Value = vbChecked Then
DistanationFile = Left$(File1.FileName, Len(File1.FileName) - 4) & txtAppend.Text & Right$(File1.FileName, 4)
ElseIf Check1.Value = vbChecked Then
DistanationFile = Left$(File1.FileName, Len(File1.FileName) - 4) & Format(Now, "dd-mm-yy-h-n") & Right$(File1.FileName, 4)
Else
DistanationFile = DatabaseFile
End If
If Len(Dir2.Path) > 3 Then 'not a root directory
DestDir = Dir2.Path & "\"
Destination = DestDir & DistanationFile
Else
DestDir = Dir2.Path
Destination = DestDir & DistanationFile
End If
'start copying
CopyFileWindowsWay Source, Destination
File2.Refresh
End Sub