Solved

Backing up Access Database

Posted on 2003-11-13
6
208 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

747 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

13 Experts available now in Live!

Get 1:1 Help Now