Solved

Backing up Access Database

Posted on 2003-11-13
6
209 Views
Last Modified: 2010-05-03
I have an Access database that I want to automatically make a backup copy of it daily and place the copy in a different directory.  Just, wondering, is this doable in VB application?  If so, how do I do it?

Thanks in advance.
Bing
0
Comment
Question by:JamesBing
6 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9741378
You could just as easily do it with a batch file, but VB could certainly do it as well.

1) Are you wanting your backup "app" to be running constantly, and then make a backup when it sees that it is time?

2) Do you just want a backup whenever you bootup?

3) Do you want to use "Scheduled Tasks" in windows to run your backup app at a specified time?

Many options...let us know.

Idle_Mind
0
 

Author Comment

by:JamesBing
ID: 9741419
I want to run at a certain time say 10AM.

I wrote a batch file to do this, but somehow it doesn't work.  I mean, it does work, but I don't know what happen recently it doesn't work anymore (http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_20797170.html).  That's why I'm writing it in VB.

bing
0
 
LVL 4

Accepted Solution

by:
TomLaw1999 earned 250 total points
ID: 9741793
Hi James,

If this is a plain Access  MDB file you can copy it with the copyfile API function.

Just declare it like this:

Public Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long

Then call it from your program using something like this:

CopyFile Serverpath & "System7.mdb", "C:\Adir\Client.bak"

In this example System7.mdb represents the access data file
Client.bak is the backup copy

I suppose you could get your program to check the system time and back up at the same time every day.

0
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 9741800
The beauty about using the Copyfile function is that it will allow you to copy a file whilst it is still open.
0
 
LVL 3

Expert Comment

by:Basker
ID: 9749567
Better thing is to create another program to take care backups,cleanup stuff etc. In that program you can allow the users to customize the backup time, etc., Make sure the program is running for 24 hrs.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now