Autobackup function for Backend (1 Viewer)

Yatiman Idara

Registered User.
Local time
Yesterday, 22:57
Joined
Apr 22, 2016
Messages
27
Hey guys,

So this is the scenario I find myself in.

A split database. I would like to make autobackups of our Backend (BE) everyday at 4pm local time??

Since I didn't know how to do that I settled for another option. I already have a function to make backups so I thought maybe I run this function using autoexec macro everytime BE is opened.

Problem... Well I am guessing that linking to BE does not trigger the autoexec since my autoexec is not making a backup when I link to the BE from FE.

Any ideas or help on how I can set up autobackup of the BE?

Thanks
 

CJ_London

Super Moderator
Staff member
Local time
Today, 06:57
Joined
Feb 19, 2013
Messages
16,607
use windows task scheduler to copy the backend
 

Yatiman Idara

Registered User.
Local time
Yesterday, 22:57
Joined
Apr 22, 2016
Messages
27
Thanks you for that, I will give that a try to see how I go
 

missinglinq

AWF VIP
Local time
Today, 01:57
Joined
Jun 20, 2003
Messages
6,423
Also, you need to consider whether or not you have exclusive access to the Back End! Will all copies of the Front End be shut down at 4pm, when you want to run this, or will users still have the app open?

Some backup hacks take this into account, in their code, and some do not!

Linq ;0)>
 

Yatiman Idara

Registered User.
Local time
Yesterday, 22:57
Joined
Apr 22, 2016
Messages
27
Also, you need to consider whether or not you have exclusive access to the Back End! Will all copies of the Front End be shut down at 4pm, when you want to run this, or will users still have the app open?

Some backup hacks take this into account, in their code, and some do not!

Linq ;0)>

Thanks for that. I haven't come code that kicks users out before backup. Does anyone know how I can do that?
 

GohDiamond

"Access- Imagineer that!"
Local time
Today, 01:57
Joined
Nov 1, 2006
Messages
550
Shutting down all FE at a particular time would require some planning on your part.
1) Educating users - Informing them that the database will shut down at a particular time. and how long they need to wait before attempting to log back in.
2) Scheduling the shutdown mechanism whether you also do it by windows task scheduler or other method.
3) Popping up a warning prior to shutdown. (with a grace period to allow users to finish up within a reasonable timeframe like 5 minutes)
4) AutoSaving any open objects in the FE before shutdown or NOT
5) Preventing login attempts during the process (possibly by using an autoexec clue in the FE)
6) Letting users know when they can safely log back in (Optional)

You can choose how nice you want to be to your users, who are in effect your consumers/customers.
This info may help
http://www.access-programmers.co.uk/forums/showthread.php?p=655962#post655962
Cheers!
Goh
 
Last edited:

cnstarz

Registered User.
Local time
Today, 00:57
Joined
Mar 7, 2013
Messages
89
Thanks for that. I haven't come code that kicks users out before backup. Does anyone know how I can do that?

You can create a table in the backend with one field called "KickUsers" where it's type is Yes/No. Then create a form in the front-end whose recordset is based on that table, and make the form hidden and load on Startup. Use the Form.OnTimer event to check if the "KickUsers" field is Yes. If it is, then Application.Quit. I set the timer for 15 seconds.

As far as backing up, I recently created a module that just copies the backend database to a backup folder during 4 different time periods throughout the day when the front end opens up. I did this by looping through the directory and checking the .DateLastModified of each file. If there isn't a backup created within the last 6 hours then it makes a new copy of the backend into the backup directory. Something like the air code below (the actual VBA code is on a different network, so I can't just copy/paste it here):

Code:
   For each file in directory
      If datediff("hh", Now(), file.DateLastModified) < 6 _
      And Right(file.Name, 6) = ".accdb" Then
         blnBackupExists = True
      End if
   Next file

   If Not blnBackupExists then
      '// Code to copy backend to directory
   End if
 

Users who are viewing this thread

Top Bottom