Question:
How can I back up a database via E3?
Solution:
To do so, there are two possibilities:
1. In an Access database, copy the file corresponding to the database manually.
2. In an SQL database, create a button on screen and, in its Click event, insert a script that sends a command to the SQLServer to execute the backup. For example:
‘Refers the ActiveX:
Set Server = CreateObject(“SQLDmo.SqlServer”)
‘Enables login verification and creates a secure connection:
Server.LoginSecure = True
Server.Connect SQLServer
‘Effective BackUp:
Set objBackup = CreateObject(“SQLDMO.Backup”)
‘Sets up properties:
objBackup.BackupSetName = ArqBackUpName
objBackup.Database = BDName
objBackup.Action = “0”
objBackup.BackupSetDescription = BackupSetDescription
objBackup.Files = ArqBackUpName & “.bak”
objBackup.TruncateLog = “0”
objBackup.Initialize = True
objBackup.SQLBackup Server
‘Disconnects from SQL server:
Server.disconnect
‘clean up
set Server = nothing
set objBackup = Nothing