I thought there was more to the story here.
I use the following code to do back ups of my BACK END.
When I open my database I use fso to find the last created copy and if it is more than a week old make a new copy with the below code.
For the FRONT END I just periodically copy and paste a copy to a subfolder.
Code:
Public Sub BackUpAndCompactBE()
'Courtesy of Brent Spaulding (datAdrenaline), MVP
'Modified by theDBguy on 5/27/2019
'Source: http://www.accessmvp.com/thedbguy
On Error GoTo errHandler
Dim strDestination As String
Dim strSource As String
Dim strTableName As String
Dim strFileName As String
Dim BUFolder As String
'Create a file scripting object that will backup the db
Dim oFSO As New FileSystemObject
strTableName = "tblCases" 'name of your linked table
'Get the source of your back end
strSource = Split(Split(CurrentDb.TableDefs(strTableName).Connect, _
"Database=")(1), ";")(0)
' strFileName = Format(Now, "mmddyyyy") & oFSO.GetFileName(strSource) 'append to beginning of file name
strFileName = oFSO.GetBaseName(strSource) & Format(Now, "mmddyyyy") & "." & oFSO.GetExtensionName(strSource) 'append to end of file name
BUFolder = CurrentProject.Path & "\DataBackUps"
'Determine your destination
strDestination = oFSO.BuildPath(BUFolder, strFileName)
'Flush the cache of the current database
DBEngine.Idle
'execute the backup
oFSO.CopyFile strSource, strDestination
Set oFSO = Nothing
'Compact the new file, ...
Name strDestination As strDestination & ".cpk"
DBEngine.CompactDatabase strDestination & ".cpk", strDestination
'Uncomment the following line and comment the previous line
'if your backend file is password protected or if you want the backup to have a password
'DBEngine.CompactDatabase strDestination & ".cpk", strDestination, , , ";pwd=YourPassword"
Kill strDestination & ".cpk"
'Notify users
' MsgBox "Backup file '" & strDestination & "' has been created.", _
' vbInformation, "Backup Completed!"
errExit:
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
Resume errExit
End Sub