anyone know how to make a backup button in the mainform? ive been searching in the google and it seems too hard to find 1....
A bit more explanation will be required
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
ok i found a code on how to make a backup button on the form
here it is
but when i ran it a debbuger appear in the line that was highlighted...Private Sub Button_Backup_Click() Dim str As String Dim buf As String Dim MD_Date As Variant Dim fs As Object Dim source As String Const conPATH_FILE_ACCESS_ERROR = 75 On Error GoTo Backup_Button_Backup 'buf = Back Up Folder 'buf is created if it does not exist 'CurrentProject.Path = the path that the FE is located buf = CurrentProject.Path & "\Backups\" MkDir buf Resume Backup_Button_Backup Backup_Button_Backup: 'Use yyyy-mm-dd hh-mm-ss as folder name. Change as needed. MD_Date = Format(Date, "yyyy-mm-dd ") & Format(Time, "hh-mm-ss") str = CurrentProject.Path & "\Backups\" & MD_Date 'Source = where the data is stored source = CurrentProject.Path & "\Data\" MkDir str Set fs = CreateObject("Scripting.FileSystemObject") 'Change the file extension as needed fs.CopyFile source & "*.accdb", str Set fs = Nothing MsgBox "Data backup at " & vbCrLf & MD_Date & vbCrLf & "successfully!", _ vbInformation, "Backup Successful" Exit_Button_Backup: Exit Sub Err_Button_Backup: If err.Number = conPATH_FILE_ACCESS_ERROR Then MsgBox "The following Path, " & str & ", already exists or there was an Error " & _ "accessing it!", vbExclamation, "Path/File Access Error" Else MsgBox err.Description, vbExclamation, "Error Creating " & str End If Resume Exit_Button_Backup End Sub
this line is in yellow...fs.CopyFile source & "*.accdb", str
can anyone fix the code?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks