When I open the backup file created from the code, I get this message:
If ‘AutoExec’ is a new macro or macro group, make sure you have saved it and that you have typed its name correctly.
The code is a module that runs in the OnLoad event of the Navigation Form that opens automatically when opening the database. The Navigation Pane is empty.
This doesn't happen with ALL the backups. Our server creates backups, but I do not have access to them and our IT is off-site and not always available to restore.
The backup is for front end only, which I work on daily as this database is still in the building phase.
Public Function CreateBackup() As Boolean
Dim Source As String
Dim Target As String
Dim objFso As Object
Dim Path As String
Source = CurrentDb.Name
'Path = CurrentProject.Path
Path = "P:\Angel\AngelNet Backups\"
Target = Path & "\BackupDB_" & Format(Now(), "mm-dd-yyyy") & ".accdb"
Set objFso = CreateObject("Scripting.FileSystemObject")
Call objFso.CopyFile(Source, Target, True)
End Function
This i got from the microsoft website :
https://learn.microsoft.com/en-us/office/troubleshoot/access/error-running-macro
So, could you take a look and check if the macro is called somewhere ? Is the file trusted ? Sometimes a header appears asking you to enable the content of the access database. If you go to starts => options => TrustCentrum. Here you can add a trusted network folder or drive. From then of the file is trusted and the message will normaly no long appear.