Solved

Backing up Access Database

Posted on 2003-11-13
6
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 86

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 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